ON THE FIRST day of the new Congress, two leading senators announced they would join in an attempt to reverse the hasty and ill-considered decision of the previous Congress to deprive foreign prisoners at Guantanamo Bay of the ancient right of habeas corpus, which allows the appeal of imprisonment to a judge. One of the senators, Arlen Specter (R-Pa.), predicted that the courts would rule that the provision of the Military Commissions Act eliminating habeas corpus was unconstitutional; he nevertheless joined the incoming chairman of the Senate Judiciary Committee, Patrick J. Leahy (D-Vt.), in sponsoring a bill restoring the appeal right.

Now Mr. Specter's prediction is looking less sure: The U.S. Court of Appeals for the D.C. Circuit ruled this week that Congress's act was constitutional, and it threw the cases of dozens of Guantanamo detainees out of federal court. That ruling will almost certainly be reviewed by the Supreme Court on appeal, but Congress should not wait for its decision. It should move quickly on the Habeas Corpus Restoration Act.

The Supreme Court has already twice overruled decisions by the D.C. Circuit denying Guantanamo detainees habeas rights, but it is hard to predict whether it will do so again. The court's composition has changed since those rulings, with the addition of justices more likely to be sympathetic to the arguments of the Bush administration. Congress has reversed part of the basis for the court's previous rulings by enacting a statute saying that persons found to be "enemy combatants" by military review panels, including detainees held at Guantanamo, have only a limited right of appeal.

The principal remaining question is whether Congress's action is permitted under Article I, Section 9 of the Constitution, which says, "The Privilege of the Writ of Habeas Corpus shall not be suspended" except in cases of "Rebellion or Invasion." Two judges of the three-member appeals court panel ruled that the provision does not apply at Guantanamo because it is not on U.S. territory and the detainees are foreigners. A dissent written by Judge Judith Rogers pointed out that one of the earlier Supreme Court rulings stated that giving appeal rights to Guantanamo inmates "is consistent with the historical reach of the writ of habeas corpus." But the court has not ruled squarely on the constitutional issue.

Rather than wait for the court's decision, Congress should correct its own mistake. The 51 to 48 vote rejecting Mr. Specter's previous attempt to restore habeas condemned hundreds of foreign prisoners to indefinite detention without trial at Guantanamo; only a few score are expected to be prosecuted by the military commissions. Since 2002 it has become clear that a number of prisoners at the facility were arrested in error, are not terrorists and pose no threat to the United States. Moreover, improvements in the prisoners' treatment have come about largely because of their court appeals. Congress has both a practical and a moral interest in ensuring that this basic human right is restored.