WASHINGTON (Reuters) - Guantanamo Bay prisoners can go before U.S. federal judges to challenge their years-long detention, the Supreme Court ruled on Thursday in a landmark decision that delivered a stinging setback for President George W. Bush’s policies.

In this image reviewed by the U.S. Military, two soldiers talk at dawn at the entrance to a hangar at Guantanamo Bay U.S. Naval Base in Cuba June 6, 2008. REUTERS/Brennan Linsley/Pool

By a 5-4 vote, the nation’s highest court struck down the law that Bush pushed through the Republican-led Congress in 2006 that took away the habeas corpus rights of the terrorism suspects to seek full judicial review of their detention.

“We’ll abide by the court’s decision. That doesn’t mean I have to agree with it,” Bush told a news conference in Rome, where he was on a weeklong European visit. “We’ll study this opinion and we’ll do so ... to determine whether or not additional legislation might be appropriate.”

In its fourth major ruling rejecting the administration’s war-on-terrorism arguments, the Supreme Court restored the detainees’ rights under habeas corpus, a long-standing legal right in which individuals can challenge their imprisonment.

“Security subsists, too, in fidelity to freedom’s first principles. Chief among these are freedom from arbitrary and unlawful restraint,” Justice Anthony Kennedy wrote in the court’s 70-page majority opinion.

Some detainees have been held for six years, without any definitive judicial determination of their detention, he said, adding the war on terrorism, which began Sept 11, 2001, has already become among the longest wars in American history.

Kennedy said Congress had failed to create an adequate alternative for the prisoners held at the U.S. military base in Cuba to contest their detention.

The 2006 law allowed for only a limited review by a U.S. appeals court in Washington of the military’s designation of the prisoners as “enemy combatants.”

Kennedy said the court’s ruling did not address whether Bush has the power to detain the prisoners. He said this and other questions on the legality of their detention must be resolved by the federal judges.

Chief Justice John Roberts in dissent wrote that the American people “lost a bit more control over the conduct of this nation’s foreign policy to unelected, politically unaccountable judges.”

And Justice Antonin Scalia wrote of the ruling, “Most tragically it sets our military commanders the impossible task of proving in a civilian court ... that evidence supports the confinement of each and every prisoner.”

Amnesty International, which has campaigned for the prisoners’ rights, welcomed the ruling.

“The Supreme Court did the right thing. Everyone has the right to challenge why they’re being thrown in prison, to hear the charges against them and to answer to that,” said Dalia Hashad, the group’s domestic human rights program director.

REPUDIATES BUSH’S POLICY

“Today’s decision forcefully repudiates the essential lawlessness of the Bush administration’s failed Guantanamo policy,” said Steven Shapiro of the American Civil Liberties Union.

The majority consisted of the court’s four liberals -- Justices John Paul Stevens, David Souter, Ruth Bader Ginsburg and Stephen Breyer, plus the moderate conservative Kennedy, who often casts the decisive vote.

The four conservative dissenters were Roberts and Justice Samuel Alito, both appointed by Bush, and Justices Scalia and Clarence Thomas.

The high court has ruled against the administration in two previous Guantanamo cases and in one other terrorism case.

Congress adopted new measures including the 2006 law aimed at keeping such cases out of court by stripping the prisoners of their habeas corpus rights under federal law.

The ruling marked the first time the court has held that the Guantanamo prisoners have those rights under the U.S. Constitution.

Kennedy said the prisoners do not lose their right of habeas corpus review just because they are designated enemy combatants or because they are held at Guantanamo, which is outside U.S. territory.

The Guantanamo prison opened in January 2002 after the administration launched what Bush called a “war on terrorism” in response to the Sept. 11 attacks.

“The entire basis for the existence of Guantanamo Bay is gone,” said Navy Lt. Cmdr. Brian Mizer, a military lawyer assigned to defend Osama bin Laden’s driver, Salim Hamdan, in the Guantanamo tribunals.

“It’s a victory for all Americans because it reinforces the principle that no person or agency is above the law.”

There now are about 270 prisoners at Guantanamo. Most have been held for years without being charged and many have complained of abuse.

Bush has acknowledged the prison’s damage to the U.S. image and has said he would like to see it closed eventually. Both the Democratic presidential candidate Barack Obama and his Republican rival, Sen. John McCain, have pledged to close it.

McCain told reporters in Boston he was concerned about the decision. “These are unlawful combatants. They are not American citizens,” he said.

The chief judge of the U.S. District Court in Washington, Royce Lamberth, said the court’s judges would meet to consider how to proceed with the Guantanamo detainee cases in light of the ruling. There are nearly 200 Guantanamo cases before the court.