WASHINGTON — The Senate approved a major revision of the 30-year-old law regulating the government's electronic surveillance program Wednesday, ending a debate that threatened to freeze intelligence operations.

The bill, which President Bush promised to sign, is designed to end at least 40 lawsuits against telecommunication companies that have aided the government.

"Any company who assisted us following the attacks of 9/11 deserves a round of applause and a helping hand, not a slap in the face and a kick to the gut," Sen. Orrin Hatch, R-Utah, said Wednesday during Senate debate.

The Senate passed the bill, 69-28, after rejecting amendments aimed at limiting the companies' ability to gain immunity from the current and future lawsuits. The House of Representatives approved the bipartisan compromise last month by a 293-129 vote.

Bush said the bill will allow the government "to quickly and effectively monitor the plans of terrorists outside the U.S., while respecting" civil liberties.

Sen. Bob Bennett, R-Utah, said the final bill "respects Americans' civil liberties while providing our intelligence community the authority it needs to protect our national security."

Congress faced pressure to pass the bill because wiretaps granted under interim legislation were to expire in August. If the government had to get new orders, it could have delayed ongoing operations.

The bill would give a secret court the power to supervise the administration's warrantless surveillance program, which was launched after 9/11 to hunt terrorists.

An amendment that would have allowed the lawsuits was killed on a 32-66 vote.

The amendment was supported by Sen. Barack Obama, D-Ill., who left his presidential campaign to vote. He voted for the overall bill.

Sen. John McCain, R-Ariz., the presumptive Republican presidential nominee, was campaigning and did not vote. He said he supported the bill and immunity.

Opponents said the bill codifies an unconstitutional program. The American Civil Liberties Union and the Electronic Frontier Foundation vowed a court challenge.

"This program broke the law, and this president broke the law," said Sen. Russ Feingold, D-Wis., a leading opponent. Senators will regret they passed the law if they learn more about the program, he said.

Bush authorized warrantless intercepts of international calls between suspected terrorists abroad and people in the U.S. soon after the Sept. 11 terrorist attacks. Warrants for such surveillance typically must be approved by a special court created by the Foreign Intelligence Surveillance Act of 1978, which aimed to better regulate surveillance of foreign spies or terrorists operating in the U.S.

The 1978 law was passed after revelations of domestic spying by the FBI and CIA.

After "The New York Times" revealed the warrantless surveillance program in 2005, Bush agreed to place the program under the FISA court's supervision — but only if Congress provided immunity for telecommunication companies being sued for cooperating with the eavesdropping.

Contributing: Lee Davidson, Deseret News