WASHINGTON -

Congress passed a massive $662 billion defense bill yesterday after months of wrangling over how to handle captured terrorist suspects without violating Americans' constitutional rights.

A last-minute compromise produced a truce, but lawmakers said the fight's not over.

The Senate voted, 86-13, for the measure and will send it to President Obama for his signature. The bill would authorize money for military personnel, weapons systems, the wars in Afghanistan and Iraq, and national-security programs in the Energy Department for the fiscal year beginning Oct. 1. The legislation is $27 billion less than Obama wanted and $43 billion less than Congress gave the Pentagon this year, a reflection of deficit-driven federal budgets, the end of the Iraq war and the drawdown in Afghanistan.

In a rare show of bipartisanship, the House voted 283-136 for the measure late Wednesday. Sen. John McCain, of Arizona, the senior Republican on the Armed Services Committee, said yesterday that the cooperation was a "little ray of sunshine" in a bitterly divided Washington.