House and Senate negotiators have reached agreement on a $585 billion defense policy bill that provides funds to expand the U.S. mission in Iraq to counter Islamic State militants and gives the military the authority to train moderate Syrian forces.

The overall legislation endorses President Barack Obama’s latest request to Congress in the 4-month-old war against Islamic extremists who brutally rule large sections of Iraq and Syria. Obama sought billions for the stepped-up operation and the dispatch of up to 1,500 more American troops.

The administration also pressed for reauthorization of its plan to train and equip moderate Syrian rebels battling the forces of President Bashar Assad, with that mandate expiring Dec. 11. The legislation would extend that authority for two years.

The bill would provide the core funding of $521.3 billion for the military, including a 1 percent pay raise for the troops and money for aircraft, ships and war-fighting equipment. It also includes $63.7 billion for overseas operations in Afghanistan and Iraq, where fighting has lasted more than a decade.

Senior House and Senate aides described the details of the legislation but were not authorized to discuss the bill on the record ahead of the official release of the measure.

The House is expected to vote on the bill this week and the Senate will consider it next week. The sweeping bill is one of the few bipartisan measures in Congress that has successfully made it to the president’s desk for more than half a century.

The bill leaves in place restrictions on the transfer of terror suspects from the federal prison at Guantanamo Bay, Cuba, to the United States or other countries.

Sen. Carl Levin, D-Mich., chairman of the Armed Services Committee, had pushed to give the president additional authority to transfer detainees, calling it a “path to close Guantanamo.” But House and Senate negotiators balked at any attempts to ease the restrictions.

The bill also takes steps to combat sexual assault in the ranks.