The decision is seen as a major defeat for the Bush administration.
In the majority opinion, Justice Anthony Kennedy wrote, "Within the Constitution's separation-of-powers structure, few exercises of judicial power are as legitimate or as necessary as the responsibility to hear challenges to the authority of the executive to imprison a person. Some of these petitioners have been in custody for six years with no definitive judicial determination."
Kennedy was joined by the court's four-member liberal bloc.
The case was brought by a group of terror suspect held at Guantanamo. They were captured in U.S. operations in Afghanistan and elsewhere and are scheduled to be tried by a military tribunal established by presidential order. They deny being members of al-Qaida.
The Supreme Court ruled earlier that the detainees had the right under U.S. law to access the federal courts but Congress amended the law several times to deny that right. Thursday's ruling said the detainees have the right to habeas corpus -- constitutional review of their detentions by the U.S. courts -- regardless of congressional law.
The decision doesn't apply to U.S. detainees held outside the United States in places other than Guantanamo, though lawyers could argue that its tenets could be applied elsewhere.
(No. 06-1195, Boumediene et al vs. Bush et al)
Swim Week Miami Beach 2014 [PHOTOS]