WASHINGTON — The Supreme Court ruled Thursday that President Bush overstepped his authority in ordering military war crimes trials for Guantanamo Bay detainees.

The ruling, a rebuke to the administration and its aggressive anti-terror policies, was written by Justice John Paul Stevens, who said the proposed trials were illegal under U.S. law and international Geneva conventions.

In brief comments, Bush said he will work with Congress to get approval to try terrorism suspects before military tribunals.

“To the extent that there is latitude to work with the Congress to determine whether or not the military tribunals will be an avenue in which to give people their day in court, we will do so,” he said. “The American people need to know that the ruling, as I understand it, won’t cause killers to be put out on the street.”

The case focused on Salim Ahmed Hamdan, a Yemeni who worked as a bodyguard and driver for Osama bin Laden in Afghanistan. Hamdan, 36, has spent four years in the U.S. prison in Cuba. He faces a single count of conspiring against U.S. citizens from 1996 to November 2001.

The ruling raises major questions about the legal status of about 450 men still being held at Guantanamo and exactly how, when and where the administration might pursue the charges against them.

It also seems likely to further fuel international criticism of the administration, including by many U.S. allies, for its handling of the terror war detainees at Guantanamo in Cuba, Abu Ghraib in Iraq and elsewhere.

Slideshow: Inside Guantanamo
The ruling prompted Senate Majority Leader Bill Frist, (R-Tenn.), to pledge to introduce a new bill after the July 4th recess.

“I will introduce legislation, in consultation with the Administration and my colleagues, that authorizes military commissions and appropriate due process procedures for trials of terrorist combatants,” Frist said. “To keep America safe in the war on terror, I believe we should try terrorists only before military commissions, not in our civilian courts.”

White House counselor Dan Bartlett said the administration’s task now is mostly technical — trying to determine how to design military tribunals that would pass muster under the decision. Republican senators said they would cooperate.

Two years ago, the court rejected Bush’s claim to have the authority to seize and detain terrorism suspects and indefinitely deny them access to courts or lawyers. In this follow-up case, the justices focused solely on the issue of trials for some of the men.

Moderate joins liberalsThe vote was split 5-3, with moderate Justice Anthony M. Kennedy joining the court’s liberal members in ruling against the Bush administration. Chief Justice John Roberts, named to the lead the court last September by Bush, was sidelined in the case because as an appeals court judge he had backed the government over Hamdan.

Thursday’s ruling, handed down on the last day of the court’s 2005-06 term, overturned that decision.

Bush spokesman Tony Snow said the White House would have no comment until lawyers had had a chance to review the decision. Officials at the Pentagon and Justice Department were planning to issue statements later in the day.

The administration had hinted in recent weeks that it was prepared for the court to set back its plans for trying Guantanamo detainees.

The president also has told reporters, “I’d like to close Guantanamo.” But he added, “I also recognize that we’re holding some people that are darn dangerous.”

Other justices make commentsJustice Clarence Thomas wrote a strongly worded dissent and took the unusual step of reading part of it from the bench — something he had never done before in his 15 years.

He said the court’s decision would “sorely hamper the president’s ability to confront and defeat a new and deadly enemy.”

The court’s willingness, Thomas wrote in the dissent, “to second-guess the determination of the political branches that these conspirators must be brought to justice is both unprecedented and dangerous.”

In his own opinion siding with the majority, Justice Stephen Breyer said that “Congress has not issued the executive a ’blank check.”’

“Indeed, Congress has denied the president the legislative authority to create military commissions of the kind at issue here. Nothing prevents the president from returning to Congress to seek the authority he believes necessary,” Breyer wrote.

Justices also rejected the administration’s claim that the case should be thrown out on grounds that a new law stripped their authority to consider it.

“It’s certainly a nail in the coffin for the idea that the president can set up these trials,” said Barbara Olshansky, legal director of the Center for Constitutional Rights, which represents about 300 Guantanamo detainees.

No word on prison statusThe court’s ruling says nothing about whether the prison should be shut down, dealing only with plans to put detainees on trial.

“Trial by military commission raises separation-of-powers concerns of the highest order,” Kennedy wrote in his opinion.

The prison at Guantanamo Bay, erected in the months after the Sept. 11, 2001, terror attacks on the United States, has been a flash point for international criticism. Hundreds of people suspected of ties to al-Qaida and the Taliban — including some teenagers — have been swept up by the U.S. military and secretly shipped there since 2002.

Three detainees committed suicide there this month, using sheets and clothing to hang themselves. The deaths brought new scrutiny and criticism of the prison, along with fresh calls for its closing.

Hamdan claims the military commissions established by the Pentagon on Bush’s orders are flawed because they violate basic military justice protections.

Hamdan says he is innocent and worked as a driver for bin Laden in Afghanistan only to eke out a living for his family.