The Supreme Court yesterday took back the moral high ground in America's fight against terrorism, even as President Bush quickly signaled that he'd gladly surrender it again.

Neither Congress nor Bush's successor in the White House should let that happen.

The court's historic ruling upholding the right of hundreds of Guantanamo Bay, Cuba, detainees to challenge in the federal courts their years-long captivity redresses an awful injustice committed in the nation's name.

Now a dark chapter in the history of a proud democracy could be nearing an end, since there's no longer a shred of doubt that Guantanamo should be closed.

At Bush's order, terror suspects have been jailed there for nearly six years without charge and with no independent review of their detention. Worse yet, some of the prisoners who were picked up off battlefields in Afghanistan, Iraq and elsewhere were harshly interrogated using tactics that amounted to torture.

Even so, Bush fought hard against according even the basic legal rights granted an American under arrest. After two previous Supreme Court rulings tripped up the justice-lite system set up by Bush lawyers to put the detainees on trial, the president did the unthinkable: He convinced a compliant Congress to outlaw the federal courts from intervening under the Constitution's most fundamental human-rights precept - the writ of habeas corpus, which grants prisoners an impartial court review of their detention.

In the end, it proved fortunate that Bush and company went too far. At least for the five-member liberal majority on the court led by Justice Anthony M. Kennedy, the assault on habeas by the executive and legislative branches was the last straw. As Justice Kennedy declared, "The laws and Constitution are designed to survive, and remain in force, in extraordinary times."

These are unusual times, indeed. Out of a sense of fear, Americans could well look the other way on the detentions. That's what Chief Justice John G. Roberts Jr. and Justices Samuel A. Alito Jr., Antonin Scalia and Clarence Thomas would have us do, as the four dissenters in this case. John McCain, by the way, says he'd pick justices just like those four.

The threat of terrorism remains, and it's a stark fact that the Guantanamo detentions - with evidence tainted by torture allegations - could result in dangerous people being freed abroad. That's on Bush.

It's long past time to face up to the dangers while staying true to the nation's commitment to justice.