WASHINGTON (CNN) -- Suspected terrorists and foreign fighters held by the U.S. military at Guantanamo Bay, Cuba, have the right to challenge their detention in federal court, the Supreme Court ruled Thursday.

A prefabricated court complex has been erected at Guantanamo Bay, Cuba, to try terrorism suspects.

The decision marks another legal blow to the Bush administration's war on terrorism policies.

The 5-4 vote reflects the divide over how much legal autonomy the U.S. military should have to prosecute about 270 prisoners, some of whom have been held for more than six years without charges. Fourteen of them are alleged to be top al Qaeda figures.

Writing for the majority, 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 reconciled within the framework of the law."

Kennedy, the court's swing vote, was supported by Justices John Paul Stevens, David Souter, Ruth Bader Ginsburg and Stephen Breyer, generally considered the liberal contingent.

At issue was the rights of detainees to contest their imprisonment and challenge the rules set up to try them.  Watch how the 5-4 ruling is a major blow for the Bush administration »

A congressional law passed in 2006 would limit court jurisdiction to hear so-called habeas corpus challenges to detention. It is a legal question the justices have tackled three times since 2004, including Thursday's ruling.

Each time, the justices have ruled against the government's claim that it has the authority to hold people it considers "enemy combatants."

Preliminary hearings have begun in Guantanamo for some of the accused. A military panel this month arraigned five suspected senior al Qaeda detainees, including the alleged mastermind of the September 11 attacks, Khalid Sheikh Mohammed, who was transferred to the prison camp in 2006.

The Bush administration has urged the high court not to get involved in the broader appeals, saying the federal judiciary has no authority to hear such matters.

Four justices agreed. In a sharp dissent, read in part from the bench, Justice Antonin Scalia said the majority "warps our Constitution."

The "nation will live to regret what the court has done today," Scalia said.

He was supported by Chief Justice John Roberts and Justices Clarence Thomas and Samuel Alito.

President Bush, who is traveling in Europe, said he disagreed with the Guantanamo ruling but promised to abide by it.

"Congress and the administration worked very carefully on a piece of legislation that set the appropriate procedures in place as to how to deal with the detainees," he said. "We'll study this opinion, and we'll do so with this in mind to determine whether or not additional legislation might be appropriate so that we can safely say, truly say to the American people, 'we are doing everything we can to protect you.' "

The Pentagon declined to comment, and the Justice Department said it was reviewing the decision and was expected to comment later Thursday.

House Speaker Nancy Pelosi, D-California, welcomed the ruling, saying the Supreme Court upheld the Constitution.

"I have long been an advocate of closing Guantanamo, so I would hope this is in furtherance of taking that action," Pelosi said.

The appeals involve noncitizens. Sixteen lawsuits filed on behalf of about 200 prisoners were put on hold pending a ruling last year by a federal appeals court upholding the government's right to detain and prosecute suspected terrorists and war criminals.

An attorney for one of the detainees, Salim Ahmed Hamdan -- Osama bin Laden's alleged driver and bodyguard -- said he would file an appeal asking that charges be dropped against the Yemeni native.

"The clearest immediate impact of this ruling is to remove the remaining barriers for closing Guantanamo Bay. It means, in legal terms, Guantanamo Bay is no different than Kansas," attorney Charles Swift said.

Now the ruling has been issued, a flood of similar appeals can be expected.

The lead plaintiffs are Lakhdar Boumediene, a Bosnian, and
What ruling does President Bush disagree with? What court won't rule? Where were the citizens convicted? What did Justice Kennedy say? What does President Bush disagree with? What will the U.S. regret?
Guantanamo federal judiciary Guantanamo Bay, Cuba, "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 reconciled within the framework of the law." the Guantanamo ruling the Guantanamo ruling
question: What ruling does President Bush disagree with?, answer: Guantanamo | question: What court won't rule?, answer: federal judiciary | question: Where were the citizens convicted?, answer: Guantanamo Bay, Cuba, | question: What did Justice Kennedy say?, answer: "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 reconciled within the framework of the law." | question: What does President Bush disagree with?, answer: the Guantanamo ruling | question: What will the U.S. regret?, answer: the Guantanamo ruling