A terrorism surveillance bill that Democrats had been confident of passing was in limbo Thursday after Republicans were able to maneuver a threatened return of the legislation to the Intelligence Committee for changes.

The electronic surveillance legislation, called The RESTORE Act, would allow intelligence agencies to conduct surveillance on foreign terror suspects using U.S. infrastructure only if a court order was obtained beforehand.

Meanwhile, in the Senate, lawmakers have reached a deal with the White House to give immunity to telecommunications firms that assisted the federal government by providing phone numbers and e-mails of suspected terrorists or their sympathizers in the U.S. before being compelled by a court order, The Washington Post reports.

Click here to read The Washington Post article.

President Bush had threatened to veto any legislation that didn't include full immunity for those companies that tried to help the government after Sept. 11, 2001. Several lawsuits had emerged against three telecom companies who opponents said had violated privacy rights.

The 1978 Foreign Intelligence Surveillance Act was changed in August after the administration argued technological advances had made the old law too cumbersome and created a gap in its intelligence collection. The temporary fix, which Democrats agreed to pass if it sunset in six months, allowed the government to eavesdrop without a court order on communications conducted by a person reasonably believed to be outside the U.S., even if an American is on one end of the conversation.

Democrats want to revise the rules with new legislation to require blanket warrants, which would force intelligence agents to get court orders to surveill a suspect who they think might make a call to the U.S. or may use U.S. communications systems.

Debate on the bill proceeded throughout the day Wednesday until Republicans managed to delay passage using a procedural move known us a motion to recommit, which is a last-chance tool given to the minority party to send legislation back to the committee of jurisdiction for changes.

The motion stated that nothing in the act "shall be construed to prohibit the intelligence community ... from conducting surveillance needed to prevent Usama Bin Laden, Al Qaeda, or any other foreign terrorist organization ... from attacking the United States or any United States person."

Brian Kennedy, spokesman for House Minority leader John Boehner, told FOXNews.com that the language is a way to prevent terrorists from getting “lawyered up” and hiding behind the protections of the Fourth Amendment. Kennedy said moderate Democrats would recognize that the absence of the language in the original bill would mean a de facto guarantee of Fourth Amendment rights for terrorists overseas.

A key Republican leadership source told FOX News that Republicans are less focused on the parliamentary maneuvering itself than what they say are problems with the bill.

"The motion to recommit was only a bit player. It's the only amendment they gave us," added House Minority Whip Roy Blunt, R-Mo., in a briefing for reporters.

Taken by surprise, House Democratic leaders huddled late Wednesday to figure out how to prevent the legislation from being sent back to the committee. Procedurally, returning the legislation for review would take about nine days and for all intents and purposes would be a defeat for Democrats who had planned to pass the bill Wednesday.

House Minority Leader Steny Hoyer admitted the language puts Democrats in something of a box, but said the legislation will pass without delay.

"We will work through this," Hoyer said. "These motions to recommit are games."

However shortly after meeting, Democrats, hoping not to let the maneuvering distract attention from the expected veto override vote on Thursday, said the FISA bill would not be brought to a vote until sometime later.