A controversial provision to require the military to retain custody of terror suspects affiliated with al Qaeda, the Taliban or their allies has been approved by the Senate Armed Services Committee and will be voted on by the Senate.

The provision mandates that the military hold those captured attacking or planning to attack the U.S. or allies, even if captured in the United States. It does not apply to U.S. citizens.

In addition, the bill would not allow the transfer of Guantanamo detainees to any country where there was a "confirmed case" of a released Guantanamo detainee who "subsequently engaged in any terrorist activity."

The provisions have held up for months the National Defense Authorization Act for 2012, which outlines spending defense spending priorities. In a compromise reached in committee, several provisions were amended after objection from the Obama administration but still includes military custody for those captured in the US, which the administration objects to.

The committee agreement drew immediate criticism from the chairwoman of the Senate Select Committee on Intelligence, Sen. Dianne Feinstein, D-California, and the chairman of the Senate Justice committee, Sen. Patrick Leahy, D-Vermont.

"We have long supported providing the administration with the flexibility to address terrorism cases, including the ability to prosecute terrorists in federal criminal courts," the two committee heads said in a statement. "Regrettably, the so-called 'agreement' reached today in the Senate Armed Services Committee will only harm the efforts of intelligence and law enforcement officials to bring to justice those who would harm Americans here and abroad."