Ron Edmonds, Associated Press
President Bush signs the surveillance measure with members of Congress and his Cabinet gathered around him in the Rose Garden. Bush said the bill gives the government anti-terror tools it needs without compromising Americans' civil liberties.

WASHINGTON — President Bush signed a bill Thursday that overhauls rules about government eavesdropping and grants immunity to telecommunications companies that helped the U.S. spy on Americans in suspected terrorism cases.

He called it "landmark legislation that is vital to the security of our people."

Bush signed the measure in a Rose Garden ceremony a day after the Senate sent it to him, following nearly a year of debate in the Democratic-led Congress over surveillance rules and the warrantless wiretapping program Bush initiated after the Sept. 11, 2001, terrorist attacks. It was a battle that pitted privacy and civil liberties concerns against the desire to prevent terrorist attacks and Democrats' fears of being portrayed as weak when it comes to protecting the country.

Its passage was a major victory for Bush, an unpopular lame-duck president who nevertheless has been able to prevail over Congress on most issues of national security and intelligence disputes.

Bush said the 9/11 attack "changed our country forever" and taught the intelligence community that it must know who America's enemies are talking to and what they are saying.

"In the aftermath of 9/11," Bush said, "few would have imagined that we would be standing here seven years later without another attack on American soil. The fact that the terrorists have failed to strike our shores again does not mean that our enemies have given up."

Even before Bush signed the legislation, the American Civil Liberties Union said it would challenge the new law in court.

The president said the bill gives the government anti-terror tools it needs without compromising Americans' civil liberties.

Bush was joined at the ceremony by Vice President Dick Cheney, Attorney General Michael Mukasey, Director of National Intelligence Mike McConnell and more than a dozen members of Congress.

The ACLU's lawsuit was filed on behalf of several civil rights groups. It wants a federal judge in New York to rule that the law is an unconstitutional violation of free speech and the right against unlawful search and seizure. It also asks that the judge permanently block intelligence officials from conducting surveillance under the law.

"The new law gives the government the power to conduct dragnet surveillance that has no connection to terrorism or criminal activity of any kind," said Jameel Jaffer, director of the ACLU's National Security Project, in a conference call to reporters.

"A law like this is fundamentally inconsistent with the Constitution and with the most basic democratic values," he said.

Roger Atwood, communications director for the Washington Office on Latin America, a human rights organization for the region, said the new law will impede the group's work.

"The mere suspicion that information provided to us, to our staff, will be accessed by the U.S. government can seriously affect WOLA's credibility and our effectiveness in Latin America in moving our work forward," Atwood said in the conference call.