Taking questions Friday from reporters at a health care event in San Jose, Calif., Obama said, "It's important to recognize that you can't have 100 percent security and also then have 100 percent privacy and zero inconvenience."

It was revealed late Wednesday that the National Security Agency has been collecting the phone records of hundreds of millions of U.S. phone customers. The leaked document first reported by the Guardian newspaper gave the NSA authority to collect from all of Verizon's land and mobile customers, but intelligence experts said the program swept up the records of other phone companies too. Another secret program revealed Thursday scours the Internet usage of foreign nationals overseas who use any of nine U.S.-based internet providers such as Microsoft and Google.

In his first comments since the programs were publicly revealed this week, Obama said safeguards are in place.

"They help us prevent terrorist attacks," Obama said. He said he has concluded that prevention is worth the "modest encroachments on privacy."

Obama said he came into office with a "healthy skepticism" of the program and increased some of the "safeguards" on the programs. He said Congress and federal judges have oversight on the program, and a judge would have to approve monitoring of the content of a call and it's not a "program run amok."

"Nobody is listening to your telephone calls," he said. "That's not what this program's about."

He said government officials are "''looking at phone numbers and durations of calls."

"They are not looking at people's names and they are not looking at content. But by sifting through this so-called metadata they might identify potential leads of people who might engage in terrorism," Obama said.

The president's remarks followed an unusual late-night statement Thursday from Director of National Intelligence James Clapper, who denounced the leaks of highly classified documents that revealed the programs and warned that America's security will suffer. He called the disclosure of a program that targets foreigners' Internet use "reprehensible," and said the leak of another program that lets the government collect Americans' phone records would change America's enemies behavior and make it harder to understand their intentions.

"The unauthorized disclosure of a top secret U.S. court document threatens potentially long-lasting and irreversible harm to our ability to identify and respond to the many threats facing our nation," Clapper said of the phone-tracking program.

At the same time, Clapper offered new information about the secret programs.

"I believe it is important for the American people to understand the limits of this targeted counterterrorism program and the principles that govern its use," he said.

Among the previously classified information about the phone records collection that Clapper revealed:

-The program is conducted under authority granted by Congress and is authorized by the Foreign intelligence Surveillance Court which determines the legality of the program.

-The government is prohibited from "indiscriminately sifting" through the data acquired. It can only be reviewed "when there is a reasonable suspicion, based on specific facts, that the particular basis for the query is associated with a foreign terrorist organization." He also said only counterterrorism personnel trained in the program may access the records.

-The information acquired is overseen by the Justice Department and the FISA court. Only a very small fraction of the records are ever reviewed, he said.

-The program is reviewed every 90 days.

The Obama administration's defense of the two programs came as members of Congress were vowing to change a program they voted to authorize and exasperated civil liberties advocates were crying foul, questioning how Obama, a former constitutional scholar who sought privacy protections as a U.S. senator, could embrace policies aligned with President George W. Bush, whose approach to national security he had vowed to leave behind.

Clapper alleged that articles about the Internet program "contain numerous inaccuracies." He did not specify.

Senior administration officials defended the programs as critical tools and said the intelligence they yield is among the most valuable data the U.S. collects. Clapper said the Internet program, known as PRISM, can't be used to intentionally target any Americans or anyone in the U.S, and that data accidentally collected about Americans is kept to a minimum.

Leaders of Congress' intelligence panels dismissed the furor over what they said was standard three-month renewal to a program that's operated for seven years. Committee leaders also said the program recently helped thwart what would have been a significant domestic terrorist attack.

The NSA must collect the phone data in broad swaths, Clapper said, because collecting it narrowly would make it harder to identify terrorism-related communications.

But the widespread notion of a government dragnet ensnaring terror suspects and innocent Americans pushed typical political foes to stand together against Obama as he enforces what many likened to Bush-era policies.

"When law-abiding Americans make phone calls, who they call, when they call and where they call from is private information," said Sen. Ron Wyden, D-Ore. "As a result of the disclosures that came to light today, now we're going to have a real debate in the Congress and the country and that's long overdue."

Officials from Clapper's office, the Justice Department, NSA and FBI briefed 27 senators for some two hours late Thursday at a hurriedly convened session prompted by severe criticism and uncertainty about the program.

"The National Security Agency's seizure and surveillance of virtually all of Verizon's phone customers is an astounding assault on the Constitution," said Sen. Rand Paul, R-Ky. "After revelations that the Internal Revenue Service targeted political dissidents and the Department of Justice seized reporters' phone records, it would appear that this administration has now sunk to a new low."

Paul said he will introduce legislation ensuring that the Fourth Amendment rights against unreasonable searches and seizures apply to government search of phone records.

The surveillance powers are granted under the post-9/11 Patriot Act, which was renewed in 2006 and again in 2011. Republicans who usually don't miss a chance to criticize the administration offered full support.

"I'm a Verizon customer. I could care less if they're looking at my phone records. ... If you're not getting a call from a terrorist organization, you got nothing to worry about," said Sen. Lindsey Graham, R-S.C.

The disclosures come at a particularly inopportune time for Obama. His administration already faces questions over the Internal Revenue Service's improper targeting of conservative groups, the seizure of journalists' phone records in an investigation into who leaked information to the media, and the handling of the terrorist attack in Libya that left four Americans dead.

At a minimum, it's all a distraction as the president tries to tackle big issues like immigration reform and taxes. And it could serve to erode trust in Obama as he tries to advance his second-term agenda and cement his presidential legacy.

The Verizon order, granted by the secret FISA court on April 25 and good until July 19, requires information on the phone numbers of both parties on a call, as well as call time and duration, and unique identifiers, The Guardian reported.

It does not authorize snooping into the content of phone calls. But with millions of phone records in hand, the NSA's computers can analyze them for patterns, spot unusual behavior and identify "communities of interest" - networks of people in contact with targets or suspicious phone numbers overseas.

Once the government has zeroed in on numbers that it believes are tied to terrorism or foreign governments, it can go back to the court with a wiretap request. That allows the government to monitor the calls in real time, record them and store them indefinitely.

House Intelligence Chairman Mike Rogers, R-Mich., said that once the data has been collected, officials still must follow "a court-approved method and a series of checks and balances to even make the query on a particular number."

The steps are shrouded in government secrecy, which some lawmakers say should change.

"The American public can't be kept in the dark about the basic architecture of the programs designed to protect them," said Sen. Al Franken, D-Minn.

Verizon Executive Vice President and General Counsel Randy Milch, in a blog post, said the company can't comment on any such court order. He said Verizon take steps to protect customers' privacy, but must comply with court orders. Verizon listed 121 million customers in its first-quarter earnings report this April.

The NSA is sensitive to perceptions that it might be spying on Americans. It distributes a brochure that pledges the agency "is unwavering in its respect for U.S. laws and Americans' civil liberties - and its commitment to accountability."

Emerging from the briefing, Sen. Dianne Feinstein, D-Calif., chairwoman of the Intelligence committee, said the government must gather intelligence to prevent plots and keep Americans alive. "That's the goal. If we can do it another way, we're looking to do it another way. We'd like to."

She said Congress is always open to changes, "but that doesn't mean there will be any."