In a press conference Friday, President Obama addressed concerns about the National Security Agency and the FBI’s acquisitions of phone and internet records. Obama said that Congress approved the classified programs and added, “Nobody is listening to your telephone calls.” (Sandi Moynihan/The Washington Post)

As a junior senator with presidential aspirations, Barack Obama built his persona in large part around opposition to Bush administration counterterrorism policies, and he sponsored a bill in 2005 that would have sharply limited the government’s ability to spy on U.S. citizens.

That younger Obama bears little resemblance to the commander in chief who stood on a stage here Friday, justifying broad programs targeting phone records and Internet activities as vital tools to prevent terrorist attacks and protect innocent Americans.

The former constitutional law professor — who rose to prominence in part by attacking what he called the government’s post-Sept. 11 encroachment on civil liberties — has undergone a philosophical evolution, arriving at what he now considers the right balance between national security prerogatives and personal privacy.

“I came in with a healthy skepticism about these programs,” Obama said in San Jose on Friday. “My team evaluated them. We scrubbed them thoroughly. We actually expanded some of the oversight, increased some of safeguards. But my assessment and my team’s assessment was that they help us prevent terrorist attacks.”

“On net,” the president added, “it was worth us doing.”

As Obama strived to reassure the American people following startling revelations this week about top-secret federal data-mining and surveillance programs, he said that he, too, has long been torn on the issue and that there is no easy answer.

“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.”

Obama and his advisers and allies argue that the compromises he has made have helped safeguard the United States from a large-scale strike like the one that al-Qaeda pulled off nearly a dozen years ago.

“When you’re president of the United States, you begin every day with these briefings,” said David Axelrod, Obama’s longtime political consigliere and former White House adviser.

“I know that he lives every day with the reality that there are threats out there. That has to be an animating principle for any person,” Axelrod added. “It is a natural thing to want to do everything that you can within the appropriate parameters to thwart those threats.”

But Obama’s approach has disappointed many of his political supporters and is also serving as a rallying cry for conservative libertarians and tea party leaders, who find themselves in sync with many liberals on the surveillance issue.

Sen. Rand Paul (R-Ky.), considered a possible candidate to succeed Obama in 2016, called the surveillance programs “an astounding assault on the Constitution.”

For critics on both sides, the issue highlights the enduring power of the national security apparatus that President George W. Bush put in place after the Sept. 11, 2001, attacks.

University of Chicago law professor Geoffrey R. Stone, who hired Obama to teach there and advised his 2008 campaign, said some might have engaged in “wishful thinking” by assuming Obama was more liberal on the issue of personal privacy than he really is.

“He’s not a passionate civil libertarian; he’s a rational civil libertarian,” Stone said. “He’s cold and reasoned and fact-based. He’s not likely to go off the tracks in either direction.”

In private meetings at the White House, Obama is more pragmatic than ideological on national security issues, advisers say.

“What he wrestles with is when fighting an enemy like al-Qaeda, a terrorist group that operates in very nimble ways, how do we make sure we have authorities to target them and disrupt their activities without going overboard?” said Benjamin J. Rhodes, the deputy national security adviser. Rhodes helped Obama prepare his remarks here Friday, as well as a major national security address last month at the National Defense University.

In that speech, Obama declared that the United States had reached a “crossroads” in its fight against terrorism, as the post-Sept. 11 wars come to an end. He defended the drone program he expanded as effective, acknowledging that it kills civilians and outlining narrower guidelines for launching strikes.

Rhodes rejected a comparison between Obama and Bush as “overstated,” noting that Obama has dismantled key pieces of Bush’s national security legacy — from ending the war in Iraq to prohibiting torture to pushing, unsuccessfully so far, to close the military’s detention center at Guantanamo Bay, Cuba.

“At the same time, we’re not simply going to shut down every counterterrorism tool that we have,” Rhodes said. “We’re going to use the ones that are effective and in line with the rule of law.”

That’s the defense Obama articulated Friday when he decided to take a question from a reporter at the end of a health-care speech. In a long, meandering answer — which he appeared to deliver without notes — Obama talked about his personal views and said he welcomed a national debate on the government's counterterrorism activities.

“I think it’s healthy for our democracy,” Obama said.

But several legal scholars — including Harvard Law School professor Laurence H. Tribe, who mentored Obama as a student — criticized the president for keeping the surveillance programs so top-secret that the public could not assess them properly.

“I recognize the need to keep details confidential if the government’s anti-terrorism efforts are to succeed, but keeping details confidential isn’t the same thing as keeping so much of the thought process in the dark that a meaningful public discussion becomes essentially impossible,” Tribe said. “What has disappointed me is the absence of that discussion, which I am convinced that the president’s basic commitments to transparency ought to support.”

Civil liberties activists remember a time when Obama was more willing to challenge the government’s surveillance practices.

Laura Murphy, who directs the American Civil Liberties Union’s Washington legislative office, recalled meeting with Obama in 2005, shortly after he became a senator. She said Obama invited her and representatives from a half-dozen other civil liberties organizations to discuss how to scale back the USA Patriot Act, a sweeping security law passed in the wake of the Sept. 11 attacks. “He thought it went too far,” Murphy said.

Obama ended up co-sponsoring legislation that would have constrained the ability of intelligence officials to get a court order to obtain records from U.S. companies in terrorism investigations. The bill failed.

Then in 2006, as he began weighing a run for the White House, Obama backed reauthorizing the Patriot Act with minor modifications. By 2009, occupying the Oval Office, Obama asked Congress for a clean reauthorization of the law.

“The president’s a political animal first and foremost,” Murphy said. “He has principles, but he doesn’t always stick with them.”

The fact that Obama has maintained and justified many of the counterterrorism programs Bush established signals that future presidents, regardless of political party, are likely to uphold a sort of national surveillance state “in the foreseeable future,” said Yale Law School professor Jack M. Balkin.

“This is a permanent fixture of American security policy, and every president from now will be given the task of making it work,” Balkin said. “And every president is going to defend it.”

Eilperin reported from Washington.