WASHINGTON (AP) — President Bush on Monday signed legislation to pay for the war operations in Iraq and Afghanistan for the rest of his presidency and beyond, hailing the $162 billion plan as a rare product of bipartisan cooperation.

This bill shows the American people that even in an election year, Republicans and Democrats can come together to stand behind our troops and their families, Bush said in an Oval Office ceremony.

Bush made clear to thank members of both parties in Congress, singling out some sponsors of the long-delayed, compromise measure for praise. His positive comments contrasted with the confrontational tone that has dominated the debate between Congress and his administration over Iraq.

The legislation will bring to more than $650 billion the amount Congress has provided for the Iraq war since it began more than five years ago. For operations in Afghanistan, the total is nearly $200 billion, according to congressional officials.