David Hicks, an Australian citizen, who admitted to training with al-Qaeda, was deported to Australia to serve a nine-month prison sentence.
Almost all of the 305 prisoners at Guantanamo have been confined for years without charges and many have complained of abuse.
About 470 other prisoners have been released over the years, and the United States said it intends to try 60 to 80 of those still in detention.
The supreme court has already heard two cases about prisoners’ rights and ruled in favour of the inmates.
But the White House and congress circumvented its decisions by adopting new measures, including a 2006 law aimed at keeping such cases out of court.
Seth Waxman, a lawyer representing 37 detainees, told the supreme court on Wednesday that “if our law doesn’t apply, this is a law-free zone”, referring to the prison at the US naval base on Cuba.
He argued that the US congress wrongly stripped the prisoners in 2006 of their right to challenge an illegal detention.
Centuries of US and English legal tradition were examined in the court’s oral arguments.
Tom Wilner, also a lawyer for the detainees, said: “The question is whether the United States government escapes any obligations under the constitution or law by holding foreigners outside of the United States, or whether they have some obligation to give them a fair hearing.”
The case is being watched by governments and activists around the world, who say George Bush, the US president, has overreached his powers and committed human rights abuses in his so-called “war on terrorism”, launched after the attacks of September 11, 2001.
The Bush administration contends the detentions are lawful, humane and necessary for a new-style war.
Paul Clement, justice department solicitor general, arguing the administration’s case, said the prisoners have more rights now than under original US habeas corpus law in 1789.
He said: “This is a remarkable liberalisation.”
Gitanjali Gutierrez of the Centre for Constitutional Rights, said: “The case is a question of executive power, and how much power the courts and congress are going to give the president to hold whoever he wants, wherever he wants, whenever he wants.”
The judges are expected to hand down their decision in a few months.
In Guantanamo on Wednesday, court proceedings at the special military tribunal started against the man whose case prompted the legislation passed in 2006.
Salim Ahmad Hamdan is accused of being a member of al-Qaeda and a driver for Osama bin Laden.