Updated

President Bush signed a bill on Thursday overhauling laws on terror surveillance, a bill that represented a major victory for the White House because it included a provision to grant legal immunity to telecommunications companies that assisted secret eavesdropping in the aftermath of the Sept. 11, 2001, terrorist attacks.

"Today, I am pleased to sign landmark legislation that is vital to the security of our people. The bill will allow our intelligence professionals to quickly and effectively monitor the communications of terrorists abroad while respecting the liberties of Americans here at home," Bush said, shortly before inking his signature on the bill during a White House Rose Garden ceremony.

The bill comes after nearly a year of pushing from the White House, and nearly six months following the expiration of a temporary measure passed last August. The stalemate was broken last month when a group of House lawmakers pushed through a compromise.

The administration had sought the changes following the initial 2005 disclosure of a secret surveillance program undertaken shortly after the 2001 terror attacks. Under the program, the National Security Agency secretly monitored communications between suspected terrorists and their associates, some of whom were in the United States, including U.S. citizens, without a warrant.

Bush invoked the attacks in his remarks, saying they serve as a reminder for why the set of changes were important.

"Almost seven years have passed since that September morning when nearly 3,000 men, women and children were murdered in our midst. The attack changed our country forever. ... Few would have imagined that we would be standing here seven years later without another attack on American soil," Bush said.

But "the fact that the terrorists have failed to attack our shores again does not mean that our enemies have given up."

Bush said the law will make sure U.S. intelligence agencies "have the tools they need" to protect the United States, and his top intelligence deputies said the law will help stop future terror attacks.

"This law will play a critical role in helping prevent another attack on our soil," which he said was "the most solemn obligation that a president undertakes."

The bill signed Thursday updates the 1978 Foreign Intelligence Surveillance Act, placing the terror surveillance program under the supervision of a special court, also created by the 1978 act.

The bill also grants legal immunity to the telecommunications companies that assisted the administration's surveillance program. The president said Wednesday the immunity provision covers both past and future activities, and is necessary for successfully monitoring terrorists and preventing future attacks.

The administration had granted the companies waivers, but those waivers did not protect them from some 40 civil lawsuits filed since The New York Times first published articles revealing the program. The lawsuits are expected to be dismissed as a result of the new law.

The American Civil Liberties Union has pledged to fight the law.

After the Senate's vote to pass the bill on Thursday, ACLU Executive Director Anthony Romero said the action meant "the government has been given a green light to expand its power to spy on Americans and run roughshod over the Constitution" by allowing "unfettered and unchecked access to innocent Americans' international communications without a warrant."