President Bush and Sen. John Kerry faced very different challenges when they met Thursday night for their first debate, but only Kerry seemed to recognize exactly what he needed to do.

The Democratic nominee's task was to straighten out the internal contradictions that had facilitated the successful Republican assault on him as a flip-flopper. He bent every effort to the urgent need to appear straightforward and strong -- keeping his back straight, his head high, his answers short and his thoughts clear. For most of the night, he was the aggressor, pressing the case for a change of command in the war on terrorism, which has been Bush's strongest suit.

Bush had a different assignment. A Kerry weakened by months of Republican rhetoric painting him as a vacillating wimp was far less of a threat to a second term than the disturbing news bulletins and television pictures from the Iraq battlefront. Bush's need was to reconcile his upbeat rhetoric about the coming of a new democratic era in Iraq with the bloody warfare that has pinned 140,000 American troops in that misery-laden country with no end in sight.

In 90 minutes before the biggest audience of the campaign, Bush not only failed to do that -- he barely tried. And that omission leaves him at risk to future events as the insurgency in Iraq gathers momentum.

Instead of dealing with his greatest vulnerability, Bush did what was predictable. He repeated the favorite examples his campaign has gleaned from the abundant contradictions on Iraq policy Kerry has uttered since he first voted to authorize the use of force against Saddam Hussein back in 2002. It is a catalogue that has become familiar through millions of dollars of Republican ads, and by the time Bush had used the same phrase seven times -- citing Kerry's dismissal of Iraq as the "wrong war in the wrong place at the wrong time" -- there was a rote quality to the recital that reduced its sting.

On a day when the headlines carried news of more than 40 deaths -- most of them children -- from insurgent attacks Bush pronounced himself "realistic but optimistic" about the course of events in Iraq. Kerry briefly challenged that picture, arguing that "it's getting worse by the day." But Bush never responded directly, and estimable moderator Jim Lehrer inexplicably failed to ask the president to reconcile the glaring contradiction between the White House version of events in Iraq and the reality of the growing resistance.

I have argued for a long time that Bush's real opponent in this campaign is not John Kerry but the Iraqi insurgency, and unfortunately that is turning out to be the case. Bush did nothing during the debate to defuse the threat.

But Kerry did himself some good by refusing to be defensive about his checkered history on Iraq or attempting yet one more convoluted explanation of his incoherent past positions. Instead, he focused on future steps. His preferred solution for Iraq, starting with "a summit" of European and Middle East nations to drum up more international peacekeeping forces, may be a long shot, but when Bush failed to challenge Kerry's contention that the president's plan is simply "more of the same," the gamble did not seem totally implausible.

I thought I saw Bush wince a bit when Kerry recalled that the president's father had not tried to topple Saddam Hussein at the end of the Persian Gulf War of 1991 because he said "there was no viable exit strategy and . . . our troops would be occupiers in a bitterly hostile land."

"That's exactly where we find ourselves today," Kerry said. And though he vowed he would not pull out of Iraq without a victory, the implication of his words is clear: If Kerry wins, the future of Iraq will be left to Iraqis.

The debate confirmed that Kerry is simply incapable of appealing to people in personal terms. The kind of emotion Bush displayed when talking about Missy Johnson, the war widow he had comforted in Charlotte, just does not come from Kerry.

But he succeeded last night in separating the war in Iraq from the war on terrorism -- something Bush does not want to let happen -- and for the moment at least, his demeanor made it believable for him to say, "I've never wilted in my life. And I've never wavered in my life."

For a man who was on the ropes a couple weeks ago, it was at least enough to keep the fight going.