SAN JOSE, Calif. -

President Barack Obama vigorously defended sweeping secret surveillance into America's phone records and foreigners' Internet use, declaring "we have to make choices as a society."

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."