Updated

President Bush signed legislation Friday that intensifies the anti-terrorism effort at home, shifting money to high-risk states and cities and expanding scrutiny of air and sea cargo.

"This legislation builds upon the considerable progress we have made in strengthening our defenses and protecting Americans since the attacks of Sept. 11," Bush said in a statement.

The bill requires screening of all cargo on passenger planes within three years and sets a five-year goal of scanning all container ships for nuclear devices before they leave foreign ports. It also elevates the importance of risk factors in determining which states and cities get federal security funds. That would mean more money for such cities as New York and Washington. It also puts money into a new program to ensure that security officials at every level can communicate with each other.

While lauding Congress for passing the bill, Bush said he will continue to work with lawmakers to ensure the cargo screening provisions are workable and don't impede commerce. And he said Congress should strive to better target grant dollars to cities and states based on their vulnerability to a terrorist attack.

"This legislation makes some progress, but it also authorizes billions of dollars for grants and other programs that are unnecessary or should not be funded at such excessive levels," Bush said in a statement. "I will not request this excessive funding in my 2009 budget request."

Bush signed the bill into law in the Oval Office before heading to the FBI to have lunch with counterterrorism advisers and then talk with members of his homeland security team. "We've done a lot of work since September the 11th to make this country safe, and it is safer but it's not completely safe," he said at the FBI.

Bush meets this weekend at Camp David, Md., with Hamid Karzai, the president of Afghanistan, where South Korean hostages are being held by the Taliban and where the Afghanistan-Pakistan border is considered a haven for the al-Qaida terrorist network.

The measure carries out unfulfilled recommendations that the Sept. 11 Commission made three years ago in the wake of the terror attacks on the U.S. homeland in 2001. It was passed in the House on a 371-40 vote and 85-8 in the Senate. Republicans generally backed the bill while stressing their own administration's success in preventing another major terrorist attack.

"There is still other work to be done. I continue to believe that Congress should act on the outstanding 9/11 Commission recommendations to reform the legislative branch's oversight of intelligence and counterterrorism activities, which the commission described as dysfunctional," Bush said. "While this legislation does not heed the commission's advice, I hope Congress revisits the issue soon."

The independent 9/11 Commission in 2004 issued 41 recommendations covering domestic security, intelligence gathering and foreign policy. Congress and the White House followed through on some, including creating a director of national intelligence, tightening land border screening and cracking down on terrorist financing. Democrats, after taking over control of Congress, promised to make completing the list a top priority.

Former Rep. Lee Hamilton, D-Ind., vice chairman of the 9/11 Commission, said with enactment of the bill some 80 percent of the panel's recommendations will have been met. According to Hamilton, one shortcoming of the bill is that it fails to carry out the commission's recommendation that Congress streamline its own overlapping setup for monitoring intelligence and homeland security matters.

The legislation also:

—Authorizes more than $4 billion for four years for rail, transit and bus security.

—Requires the screening of all container ships in foreign ports within five years, but give the Homeland Security secretary authority to delay implementation.

—Establishes a new electronic travel authorization system to improve security for visitors from countries participating in the visa waiver program. Bush said he would continue to work with Congress to provide more flexibility to bring some of the closest U.S. allies into the program.

—Strengthens a board that oversees privacy and civil liberties issues.

—Establishes a voluntary certification program to assess whether private entities comply with voluntary preparedness standards.

—Requires the president and Congress to disclose total spending requested and approved for the intelligence community.

—Provides civil immunity to those who, in good faith, report suspicious activities that threaten the safety and security of passengers on a transportation system or that could be an act of terrorism.

—Requires the president to confirm that Pakistan is making progress combatting al-Qaida and Taliban elements within its boarders before the United States provides aid to the country.