Attorney General Alberto Gonzales, who announced Monday that he will step down in three weeks, played a central role in a number of controversial decisions concerning the war on terror. But his greatest vulnerability resulted from his ineffective defense of a political matter involving the tenure of U.S. attorneys. That made his resignation all but inevitable. President Bush would be wise to choose a successor who does not offer his opponents a tempting target.

Mr. Gonzales faced accusations that he acted unconstitutionally in approving an intelligence activity known as the Terrorist Surveillance Program and in approving detention and interrogation rules for captured terrorists that allegedly contravened the Geneva Conventions on the treatment of prisoners; that he improperly fired a number of the U.S. attorneys for political reasons; and that he lied to Congress.

Congress will have a hard time proving the alleged lie. In 2006 Mr. Gonzales testified that the secret monitoring of terrorist communications was not controversial within the administration. It later developed that there had been a dramatic showdown on aspects of the program in 2004 at the hospital bedside of the very ill Attorney General John Ashcroft in which then White House Counsel Gonzales took part. But the president changed the program to meet Justice Department objections, so what Mr. Gonzales told Congress in 2006 appears to have been an accurate statement.

Meanwhile, Congress has passed legislation to bring the treatment of terrorists into compliance with international law and gave its legislative approval last month to a major aspect of the terrorist communications monitoring program. That leaves the question of the U.S. attorneys the chief unsettled matter between Mr. Gonzales and Congress.

Since U.S. attorneys serve at the pleasure of the president, and since other presidents have, wholesale, fired incumbents in order to bring in their own candidates, (and, not coincidentally, often appointed a close political adviser as attorney general — think of John and Robert Kennedy), it is ridiculous to accuse Mr. Gonzales of politicizing the Justice Department. The most that can be said is that he appears to have mismanaged a legitimate exercise of president power.

Mr. Bush now faces the choice of a successor. If he is looking for a respected and experienced figure, not enmeshed in the current controversies, to head the department and restore morale, some legal scholars think he would be wise to appoint a federal appeals court judge, assuming one can be found to serve in the Justice hot seat for 16 months.

Sen. Lindsey Graham, R-S.C., has recommended such a candidate. He is William Wilkins, 65, of Greenville who recently retired as the chief judge of the Fourth Circuit Court of Appeals in Richmond, and now serves in senior status. There are undoubtedly others. Whatever the choice, it should be made quickly. The nation needs a well-led Justice Department.