WASHINGTON (AP) — Congress passed a $662 billion military spending bill on Thursday after months of wrangling over how to handle captured terrorism suspects without violating Americans’ constitutional rights.

The Senate passed the measure 86 to 13, sending it to President Obama for his signature. The House approved the measure late Wednesday, on a vote of 283 to 136.

The White House had initially threatened to veto the legislation but dropped that warning late Wednesday, saying last-minute Congressional changes meant that the legislation no longer challenged the president’s ability to fight terrorism.

The legislation authorizes money for military personnel, weapons systems, actions in Afghanistan and Iraq, and national security programs in the Energy Department for the fiscal year that began Oct. 1.