WASHINGTON  - US President Bush signed a bill Thursday that overhauls rules about government eavesdropping and grants immunity to telecommunications companies that helped the US 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 programme 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. According to AFP, the US Senate passed the bill on Wednesday. The measure includes retroactive immunity for telecommunications firms which aided warrantless government surveillance operations following the September 11 attacks in 2001 - a key demand of the White House. Senators voted 69 to 28 to pass the measure, after blocking several attempts to water down the immunity for telecom firms. Bush said the new law would help US intelligence agencies "learn who the terrorists are talking to, what they're saying, and what they're planning." "This legislation is critical to America's safety. It is long overdue," the president said, in the White House Rose Garden, as he arrived home from the G8 summit in Japan. Obama addressed the controversy in a blog post on his website. "This was not an easy call for me. I know that the FISA (the Foreign Intelligence Surveillance Act of 1978) bill that passed the House is far from perfect," Obama wrote. "I wouldn't have drafted the legislation like this, and it does not resolve all of the concerns that we have about President Bush's abuse of executive power. "It grants retroactive immunity to telecommunications companies that may have violated the law by cooperating with the Bush Administration's programme of warrantless wiretapping." But Obama said the bill did provide legal safeguards to bring warrantless wiretaping into the auspices of the courts. "In a dangerous world, government must have the authority to collect the intelligence we need to protect the American people," he said, but added an independent monitor must watch over that power to protect civil liberties. "This compromise law assures that the FISA court has that responsibility." New York Senator Hillary Clinton, who lost the Democratic nomination to Obama, voted to block the bill. Republican White House candidate John McCain did not vote as he was campaigning. Privacy advocates were dismayed. "It is an immeasurable tragedy," said Kevin Bankston, senior staff attorney of the Electronic Frontier Foundation. The new law says that the FISA court mechanism is the only way the government can order electronic surveillance of terror suspects. The 1978 law allowed the ultra-secretive National Security Agency to wiretap for 72 hours while waiting for the FISA court to approve the action. The new law, however, gives the agency a week, and it also allows them to use any information they got even if the FISA court eventually rules that the wiretap is unlawful.