For years, with the help of compliant Republicans and frightened Democrats in Congress, President Bush has denied the protections of justice, democracy and plain human decency to the hundreds of men that he decided to label “unlawful enemy combatants” and throw into never-ending detention.

Twice the Supreme Court swatted back his imperial overreaching, and twice Congress helped Mr. Bush try to open a gaping loophole in the Constitution. On Thursday, the court turned back the most recent effort to subvert justice with a stirring defense of habeas corpus, the right of anyone being held by the government to challenge his confinement before a judge.

The court ruled that the detainees being held in Guantánamo Bay, Cuba, have that cherished right, and that the process for them to challenge their confinement is inadequate. It was a very good day for people who value freedom and abhor Mr. Bush’s attempts to turn Guantánamo Bay into a constitutional-rights-free zone.

The right of habeas corpus is so central to the American legal system that it has its own clause in the Constitution: it cannot be suspended except “when in cases of rebellion or invasion the public safety may require it.”