An American appeals court has upheld an anti-terrorism provision that states that Guantanamo Bay inmates cannot challenge their detention in US courts.
There are nearly 400 detainees at Guantanamo Bay
The provision was a key element of a law for prosecuting terror suspects that President George W Bush sent through Congress last year.
The appeal court said civilian courts could not determine whether detainees were being held illegally.
The ruling is almost certain to go to the Supreme Court, correspondents say.
Last year that court threw out the government's original plans for trying detainees before military commissions.
The US Court of Appeals for the District of Columbia Circuit ruled 2-1 in favour of the provision in the Military Commissions Act.
Mr Bush had said he needed the new law to bring terror suspects to justice. It allows for the indefinite detention of people as "enemy combatants".
Writing in favour of the majority decision, Judge A Raymond Randolph said that accepting the arguments of lawyers on behalf of detainees "would be to defy the will of Congress".
Dissenting Judge Judith W Rogers said district courts would be "well able to adjust these proceedings in light of the government's significant interests in guarding national security".
There are nearly 400 detainees being held at the Cuba detention centre.
Up to 80 are set to face the new military commissions.