FROM THE BEGINNING the Bush administration undermined its plans for handling detainees captured abroad with decisions that defied both international law and common sense. President Bush decided not to apply the requirements of the Geneva Conventions to detainees at the Guantanamo Bay naval base by granting them individual hearings to resolve questions about their status. He shunned congressional involvement, relying instead on vague law that had not been used in decades to authorize military tribunals alien to American justice since the World War II era. These decisions gravely damaged U.S. standing abroad, and they have proved dicey for the administration, too, creating numerous avenues for legal challenges. Making the problem still worse, the military established rules for these trials that were flawed in key respects, giving rise to the possibility that the already-suspect tribunals would produce unfair verdicts.

Last week, with military tribunals already convened, these entirely avoidable problems came to a head: A federal judge in Washington declared that the military tribunals as currently arranged are unlawful and cannot proceed. The ruling by Judge James Robertson has serious analytical problems that make it potentially vulnerable on appeal -- which an appeals court has agreed to expedite. But Judge Robertson's essential point is one the administration should heed, out of self-interest and because correcting the problems he identifies would be the right thing to do.

Judge Robertson called a halt to the trial of Salim Ahmed Hamdan, a Yemeni alleged to have been an al Qaeda fighter in Afghanistan, because the Geneva Conventions require that all detainees be treated as prisoners of war until a "competent tribunal" determines that they don't merit that protection. A prisoner of war could never be tried before the type of military tribunal the government has established, which is known as a commission. He would be entitled, rather, to trial by court-martial, which would give him substantially greater procedural protections. Yet the military never held a hearing to determine whether Mr. Hamdan merited POW status. It didn't create any review tribunals at all, in fact, until the Supreme Court asserted jurisdiction over the base in the spring, and even then the government let them review only the question of whether an inmate was properly detained. It continued to maintain that all detainees were, by virtue of their status as Taliban or al Qaeda fighters, "unlawful combatants."

The sheer number of foreign detainees and the difficulty of trying people in American courts in cases that depend on intelligence information makes some form of military tribunal an essential component of a global anti-terrorism strategy. Unfortunately, the military's performance in putting these tribunals together has been wanting from the beginning. They were, to start, much delayed and, once constituted, they had some glaring problems. Members of the commissions were poorly chosen and the defense lawyers hopelessly outgunned. The appeal process is deeply flawed. Many military lawyers favor using courts-martial instead of commissions -- an idea that is attractive if practical problems can be overcome. But it is critical at a minimum for the commissions to be held in a fashion that is fair and worthy of international respect.

This should not be so difficult. Complying fully with the Geneva Conventions would cost the administration little. Few of the inmates at Guantanamo have a realistic claim to POW status; certainly none of the al Qaeda inmates do. And the review panels already examining whether they are properly classified as "enemy combatants" -- which have so far determined only one inmate to be wrongly classified -- have hardly proven a great burden. Involving Congress in the creation of the military tribunals that will judge these cases would greatly fortify the administration's position before the courts, whose evident discomfort with the current, unilateral approach threatens further legal troubles if Mr. Bush hews to his chosen path.