President Barack Obama declared Friday that America is “going to have to make some choices” balancing privacy and security, launching a vigorous defense of formerly secret programs that sweep up an estimated 3 billion phone calls a day and amass Internet data from U.S. providers in an attempt to thwart terror attacks.

He warned that it will be harder to detect threats against the U.S. now that the two top-secret tools to target terrorists have been publicized.

At turns defensive and defiant, Obama stood by the spy programs revealed this week.

The National Security Agency has been collecting the phone records of hundreds of millions of Americans each day, creating a database through which it can learn whether terror suspects have been in contact with people in the U.S.

It also was disclosed this week that the NSA has been gathering all Internet usage — audio, video, photographs, emails and searches — from nine major U.S. Internet providers, including Microsoft and Google, in hopes of detecting suspicious behavior that begins overseas.

“Nobody is listening to your telephone calls,” Obama assured the nation after two days of reports that many found unsettling. What the government is doing, he said, is digesting phone numbers and the durations of calls, seeking links that might “identify potential leads with respect to folks who might engage in terrorism.”

If there’s a hit, he said, “if the intelligence community then actually wants to listen to a phone call, they’ve got to go back to a federal judge, just like they would in a criminal investigation.”

While Obama said the aim of the programs is to make America safe, he offered no specifics about how the surveillance programs have done this. House Intelligence Committee Chairman Mike Rogers, R-Mich., on Thursday said the phone records sweeps had thwarted a domestic terror attack, but he also didn’t offer specifics.

Obama asserted his administration had tightened control of the phone records collection program since it started in the George W. Bush administration and is auditing the programs to ensure that measures to protect Americans’ privacy are heeded — part of what he called efforts to resist a mindset of “you know, ‘Trust me, we’re doing the right thing. We know who the bad guys are.’ ”

But again, he provided no details.

The furor this week has divided Congress, and led civil liberties advocates and some constitutional scholars to accuse Obama of crossing a line in the name of rooting out terror threats.

Obama, himself a constitutional lawyer, tried to calm Americans’ fears — but also remind them that Congress and the courts had signed off on the surveillance.

“I think the American people understand that there are some trade-offs involved,” Obama said when questioned by reporters at a health care event in San Jose, Calif.

“It’s important to recognize that you can’t have 100 percent security and also then have 100 percent privacy and zero inconvenience,” he said. “We’re going to have to make some choices as a society. And what I can say is that in evaluating these programs, they make a difference in our capacity to anticipate and prevent possible terrorist activity.”

Obama said U.S. intelligence officials are looking at phone numbers and lengths of calls — not at people’s names — and not listening in.

The two classified surveillance programs were revealed this week in newspaper reports that showed, for the first time, how deeply the National Security Agency dives into telephone and Internet data to look for security threats. The new details were first reported by the Guardian and the Washington Post, and prompted Director of National Intelligence James Clapper to take the unusual and reluctant step of acknowledging the programs’ existence.

(story can end here)

Obama echoed intelligence experts — both inside and outside the government — who predicted that potential attackers will find other, secretive ways to communicate now that they know that their phone and Internet records may be targeted.

In the immediate years after the Sept. 11, 2001, attacks, the government began collecting data from U.S. telephone companies, looking at whether overseas terror suspects were calling phone numbers in the U.S. The program does not allow the government to listen in on calls, but it can track where a call was placed and how long it lasted. If intelligence officials single out phone numbers that they want to target for eavesdropping, they must return to court to get approval.

In 2006, after the telephone surveillance was first revealed and amid a public outcry, a secret court was tasked with approving all of the government requests for the records — amounting to as many as 3 billion phone calls daily. But until this week, it was not widely known how many phone records were noted, or how often.

The NSA seizure of website and Internet provider records was even more secretive, and began only in the past few years. Clapper said those records, too, are released only with secret court orders, and monitors look only for documents that appear to have come from overseas. The data are not to be used to target U.S. citizens, and the government must try to minimize any information that was mistakenly taken from Americans.

It was not immediately clear how intelligence analysts weed out Americans’ online documents from those sent by a citizen of another country. And it’s unknown if Internet communications from citizens of the closest U.S. allies — such as Britain, Canada, Australia and New Zealand — are examined.

The new details of the broad surveillance have brought criticism from civil liberties and privacy advocates, as well as re-igniting a long-simmering debate in Congress over government power in security issues.

“Tell our nation’s leaders to stop spying on calls, email,” the Council on American-Islamic Relations wrote to its followers on Friday. The American Civil Liberties Union demanded a congressional investigation.