WASHINGTON (CNN) -- Sen. Barack Obama's vote for a federal surveillance law that he had previously opposed has sparked a backlash from his online advocates, who had energized his campaign for the Democratic presidential nomination.

Sen. Barack Obama said he voted for the surveillance bill because it will help protect the nation.

In October, Obama had vowed to help filibuster an update of the Foreign Intelligence Surveillance Act (FISA) that gave telecommunication companies that had cooperated with President Bush's warrantless wiretapping program immunity from lawsuits.

After 9/11, Bush secretly authorized the National Security Agency to eavesdrop, without the mandated warrant from a federal court, on electronic communication involving terrorist suspects.

Critics said Bush's Terrorist Surveillance Program was a violation of civil liberties.

The Senate voted Wednesday on the bill updating FISA -- which had a provision to shield telecommunications companies that had cooperated in the surveillance. Obama joined the 68 other senators who voted to send the bill to the president's desk.

Obama did vote for an amendment offered before the final vote by Sen. Christopher Dodd, D-Connecticut, that would have stripped the immunity provisions from the bill, but the amendment failed.

Bush signed the bill into law on Thursday, saying the bill "will help us meet our most solemn responsibility: to stop another attack."

The bill does not grant the telecommunication companies direct immunity, but it does contain a provision that allows a federal judge to dismiss the suits if the companies can present a letter from the government stating that the program was legal.

Mike McConnell, the director of national intelligence, testified before Congress that all the companies received such letters.

The bill also allows any warrantless wiretapping program to be reviewed by a secret federal intelligence court; requires a spy agency to purge any intelligence involving an American unless it gets a court warrant; and, for the first time, requires intelligence officials to get a court warrant if they wish to target an American living abroad. Read what's in the FISA bill

When pressed to explain his change in position by an angry questioner Thursday, Obama defended his vote, saying he opposed the immunity for the companies but ultimately voted for the bill because he felt that the revisions to the intelligence law were necessary to protect the nation's security. Watch analysts debate whether Obama is a flip-flopper »

"The surveillance program is actually one that I believe is necessary for our national security," Obama told the questioner. "So I had to balance or weigh voting against a program that I think that we need -- and that had been created so that your privacies were protected -- or create a situation in which we didn't have the program in place."

New Mexico Gov. Bill Richardson, a former Democratic presidential candidate and an Obama supporter, said Friday that the improvements to the bill allowed Obama to change his position.

"What changed is that the bill got better and more acceptable to Sen. Obama -- the judicial oversight, the fact that the president can't unilaterally say he's going to eavesdrop on citizens," Richardson said. "There are a lot of safeguards in the bill that weren't there before. Watch Richardson defend Obama's vote »

"Now, again, the telecoms -- I personally think they shouldn't have immunity. But, you know, Sen. Obama had to make that decision," Richardson said. "We do have to protect ourselves against terrorists, but I understand there's some in the base that are concerned."

Many of the liberal blogs who touted the Illinois Democrat early on have blasted Obama for changing his position.

One post on the blog DailyKos.com called Obama's decision to vote for the bill a "sellout" and a "tactical blunder." iReport.com: Was Obama's vote a "sellout"?

And on "getfisaright.com," a self-described group of 23,000 Obama supporters has posted an open letter to the presumptive Democratic presidential nominee, saying,"It is disheartening that you decided to support this bill, which does immense damage to the rule of law and our most fundamental democratic institutions.

"Even though we are disappointed, most of us continue to support you as a candidate," the group wrote. "But as a candidate you have work to do repairing our trust in you and in government."

But Richardson said the choice Obama made is just one of difficult decisions a senator -- and a president -- must make.

"There are enough safeguards in the bill and Sen. Obama said he'll review the bill again, see how it's working when he's president," Richardson said.

"So these are some of the political realities you face when you're running for president, when you're also in the Senate and you have to make a judgment on a bill."

CNN's Ed Henry and Abbi Tatton contributed to this report.

All About Espionage and Intelligence • Barack Obama • Blogs and Blogging