In a major legal setback for the Bush administration, the court overturned by five to four a ruling upholding a 2006 law which removed such rights.
It is not clear if the ruling will lead to prompt hearings for the detainees.
Some 270 men are held at the US naval base, on suspicion of terrorism or links to al-Qaeda and the Taleban.
US President George W Bush said he would abide by the court's ruling even if he did not agree with it.
Human rights groups have welcomed the move, Amnesty International saying it was an "essential step forward towards the restoration of the rule of law".
We'll study this opinion to determine whether or not additional legislation may be appropriate
US President George W Bush
Thursday's ruling potentially resurrects several cases which had been put on hold in recent months.
Federal judges, law clerks and court administrators studying the 70-page opinion to work out how to proceed.
And a military lawyer for Osama Bin Laden's former driver, Guantanamo detainee Salim Ahmed Hamdan, is requesting that charges against his client be dismissed.
"The entire basis for the existence of Guantanamo Bay is gone," said Navy Lt Cmdr Brian Mizer.
The military judge in the case had postponed Mr Hamdan's trial, which was scheduled to start earlier this month, pending the Supreme Court's judgement.
'Extraordinary times'
Wednesday's ruling related to two test cases brought by Lakhdar Boumediene, an Algerian arrested in Bosnia in 2001, and Fawzi al-Odah, a Kuwaiti seized in Pakistan in 2002, which were consolidated and brought on behalf of 37 foreign nationals at Guantanamo.
Liberty and security can be reconciled; and in our system they are reconciled within the framework of the law
Justice Anthony Kennedy
US Supreme Court
Brushing aside the government's arguments that the detainees were enemy combatants being held at a time of war outside the US, the court said they had "the constitutional privilege of habeas corpus".
This is the right of detainees under the US constitution to be heard by an independent judge.
Justice Anthony Kennedy said: "The laws and constitution are designed to survive, and remain in force, in extraordinary times. Liberty and security can be reconciled; and in our system they are reconciled within the framework of the law."
This is the Bush administration's third setback at the highest US court since 2004 over its treatment of prisoners who are being held indefinitely and without charge at the base in Cuba.
The court has ruled twice previously that Guantanamo inmates could go into civilian courts to ask that the government justify their continued detention.
In 2004, the judges found that existing law gave federal courts the right to consider challenges to the legality of the detention of foreign nationals held at Guantanamo because of the unique control the US government had over the land leased from Cuba.
Two years later, it ruled that the president did not have the authority to order the "enemy combatants" there to face military commissions.
The government responded both times by obtaining congressional legislation restricting judicial review of the detentions.
The Military Commissions Act (MCA) passed in 2006 removed the right of habeas corpus and set up tribunals to try detainees who were not US citizens.
Last week, five detainees, including key suspect Khalid Sheikh Mohammed, appeared before a military tribunal in Guantanamo Bay.
Khalid Sheikh Mohammed dismissed the trial as an "inquisition".
'Restoring credibility'
President Bush made it clear that the government would "abide by the court's decision", although he did so without enthusiasm.
Please turn on JavaScript. Media requires JavaScript to play.
President Bush's response to the ruling
"It was a deeply divided court and I strongly agree with those who dissented," he told reporters in Rome.
"We'll study this opinion to determine whether or not additional legislation may be appropriate."
Supreme Court Justice Antonin Scalia, who voted against the ruling, warned that "it sets our military commanders the impossible task of proving in a civilian court ... that evidence supports the confinement of each and every prisoner".
But the human-rights group Amnesty International urged the US government to "finally bring its detention policies and practices in the 'war on terror' in line with international standards".
For the American Bar Association, the ruling helped restore the credibility of the US as a "model for the rule of law across the globe".
Do you agree or disagree with the ruling? Send us your reaction using the form below.
Name
Your E-mail address
Town & Country
Phone number (optional):
Comments
Story from BBC NEWS:
http://news.bbc.co.uk/go/pr/fr/-/2/hi/americas/7451139.stm
Published: 2008/06/12 21:39:36 GMT
© BBC MMVIII