The US House passed a $633 billion defense authorization bill that includes fresh sanctions against Iran and funds the war in Afghanistan, while offering compromise language on military detention of US citizens.

In addition to covering standard national security expenses, it also provides a 1.7-percent pay raise for the military, authorizes the Pentagon to pay for abortions in cases of rape and incest and lifts a ban on same-sex marriage ceremonies on military bases.

The legislation, which passed 315-107, ended an indefinite restriction on the transfer of Guantanamo detainees to the United States or other countries, instead extending the current restrictions by one year.

The National Defense Authorization Act for fiscal year 2013, which began in October, was hammered out by House and Senate conferees in recent days after each chamber voted to approve separate versions of the bill.

Most NDAAs pass with broad bipartisan support after conference, and this one is expected to pass the Senate later Thursday or Friday, clearing the way for President Barack Obama to sign it into law.

The White House last month said Obama could veto the bill out of concern for the restrictions on his handling of Guantanamo detainees and other issues, but Senate Armed Services Committee chairman Carl Levin said this week he did not expect a veto.

House and Senate conferees had to compromise on overall spending figures for the bill, settling on $527.4 billion for the base Pentagon budget; $88.5 billion for overseas contingency operations including the war in Afghanistan; and $17.8 billion for national security programs in the Department of Energy and the Defense Nuclear Facilities Safety Board.

"Overall this is a good bill," congressman Adam Smith, ranking Democrat on the House Armed Services Committee, said during debate Thursday.

"Not everyone will be happy... but that's the nature of compromise."

The bill also stripped out an amendment sponsored by Democratic Senator Dianne Feinstein and Republican Mike Lee that was designed to limit the president's power to indefinitely detain US citizens as terror suspects.

The measure passed the Senate after fierce debate, but disappeared from the final version of the bill.

In a statement after agreement by conferees, Levin and ranking Republican John McCain said only that existing legislation should not be seen as denying the right to trial "to any person inside the United States who would otherwise be entitled to the availability of such writ or to such rights."

Rights groups had expressed concern with Feinstein's amendment because it referred specifically to US nationals and legal residents, leaving open the possibility that under the rule the military might be used to detain illegal immigrants.

Smith said that the amendment prohibiting for another year the use of US funds for transfer of Guantanamo inmates marked a setback for Obama's efforts to close the detention center at the US Naval base at Guantanamo Bay, Cuba.

The measure "ties the president's hands on how to deal with the people on Guanntanamo," he said.

The bill also authorizes $9.8 billion for missile defense, including funds for a Pentagon feasibility study on three possible missile defense sites on the US East Coast.

The legislation sailed through the House and is expected to do the same in the Senate despite an intensifying partisan row over how to avoid a year-end fiscal crisis.