The US House of Representatives has approved a bill that would prevent moving prisoners at the military prison at Guantanamo Bay to US soil.
The measure is being seen as a blow to President Barack Obama's efforts to prosecute military prisoners at Guantanamo in criminal courts.
It prohibits any spending to transfer such detainees or to finance facilities to hold them in the US.
The provision is part of legislation for funding government expenses.
The measure was tucked into a 400-page spending bill, which the House of Representatives approved by just six votes.
If the Senate also passes the legislation, it would cut all federal funds off until next October for the transfer of prisoners from Guantanamo to US soil.
Condemning the provision
The federal government was previously permitted to transfer prisoners, like self-professed 9/11 mastermind Khalid Sheikh Mohammed, to the US to face a trial.
The BBC's Steve Kingstone said Mr Obama considers such transfers an important step towards the eventual closure of controversial facility - something he promised on the campaign trail.
But in the first such trial, held in New York last month, the defendant - Ahmed Ghailani - was acquitted of all but one of nearly 300 terror-related charges.
That prompted criticism of the president's approach from Republicans and some Democrats.
The White House strongly opposed the House move on Wednesday, saying Congress should not limit the Obama administration's ability to prosecute the prisoners.
"Congress should not limit the tools available to the executive branch in bringing terrorists to justice and advancing our national security interests," said Justice Department spokesman Matthew Miller.
Before the measure can become law, the US Senate must also approve the same legislation, and Mr Obama must sign it.