The US Supreme Court has ruled that the Bush administration does not have the authority to try terrorism suspects by military tribunal.
Many Guantanamo detainees have been held for years
Justices upheld the challenge by Osama Bin Laden's ex-driver to his trial at Guantanamo, saying the proceedings violated Geneva Conventions.
The ruling is seen as a major blow to President George W Bush - but it does not order the closure of Guantanamo.
Mr Bush said he would respect it but also protect Americans from "killers".
The Cuba-based facility currently holds about 460 inmates, mostly without charge, whom the US suspects of links to al-Qaeda or the Taleban.
Osama Bin Laden's ex-driver, Salim Ahmed Hamdan, is one of 10 Guantanamo inmates facing a military tribunal.
He launched the proceedings demanding to be tried by a civilian tribunal or court martial, where the prosecution would face more obstacles.
In its ruling, the court said: "Whether or not the government has charged Hamdan with an offence against the law of war, cognisable by a military commission, the commission lacks power to proceed."
"The procedures adopted to try Hamdan also violate the Geneva Conventions," the justices said.
The ruling does not demand the release of prisoners held at Guantanamo but gives the administration an opportunity to come up with another way of trying those held.
The BBC's Nick Miles in Washington says the implications of the decision are profound, as Washington will either have to court-martial the detainees or try them as civilians.
It may end up releasing many prisoners and returning them to their home countries, our correspondent adds.
One of the dissenters, Justice Clarence Thomas, took the unusual step of reading part of his opinion from the bench, saying the decision would "sorely hamper the president's ability to confront and defeat a new and deadly enemy".
President Bush said he would "look seriously" at the case, adding: "The ruling, as I understand it, won't cause killers to be put out on the street."
Hamdan was a driver for Osama Bin Laden
He added that he would work with Congress "to determine whether or not the military tribunals will be an avenue in which to give people their day in court".
The decision was welcomed by senior Democratic Senator Carl Levin.
"The Supreme Court has once again demonstrated its vital constitutional role as a check and balance on the actions of the executive and legislative branches of government," he said in a statement.
Mr Hamdan had success in his first legal outing, in the US District Court in Washington, which ruled that he could not face a military trial unless he had previously been found not to be a prisoner of war under the Geneva Convention.
He claims POW status, but like all camp prisoners, he is denied this and is instead designated an "unlawful combatant" by the Bush administration.
However, an appeal court reversed this decision and said Mr Bush had the authority to order the trials.