'In the endgame," said one of the world's best-ever chess players, José Raúl Capablanca, "don't think in terms of moves but in terms of plans." The situation in Iraq is now unravelling into the bloodiest endgame imaginable. Both popular and official support for the war in those countries that ordered the invasion is already at a low and will only get lower. Whatever mandate the occupiers may have once had from their own electorates - in Britain it was none, in the US it was precarious - has now eroded. They can no longer conduct this war as they have been doing.

Simultaneously, the Iraqis are no longer able to live under occupation as they have been doing. According to a UN report released last week, 3,709 Iraqi civilians died in October - the highest number since the invasion began. And the cycle of religious and ethnic violence has escalated over the past week.

The living flee. Every day up to 2,000 Iraqis go to Syria and another 1,000 to Jordan, according to the UN's high commissioner for refugees. Since the bombing of Samarra's Shia shrine in February more than 1,000 Iraqis a day have been internally displaced, a recent report by the UN-affiliated International Organisation for Migration found last month.

Those in the west who fear that withdrawal will lead to civil war are too late - it is already here. Those who fear that pulling out will make matters worse have to ask themselves: how much worse can it get? Since yesterday American troops have been in Iraq longer than they were in the second world war. When the people you have "liberated" by force are no longer keen on the "freedom" you have in store for them, it is time to go.

Any individual moves announced from now on - summits, reports, benchmarks, speeches - will be ignored unless they help to provide the basis for the plan towards withdrawal. Occupation got us here; it cannot get us out. Neither Tony Blair nor George Bush is in control of events any longer. Both domestically and internationally, events are controlling them. So long as they remain in office they can determine the moves; but they have neither the power nor the credibility to shape what happens next.

So the crucial issue is no longer whether the troops leave in defeat and leave the country in disarray - they will - but the timing of their departure and the political rationale that underpins it.

For those who lied their way into this war are now trying to lie their way out of it. Franco-German diplomatic obstruction, Arab indifference, media bias, UN weakness, Syrian and Iranian meddling, women in niqabs and old men with placards - all have been or surely will be blamed for the coalition's defeat. As one American columnist pointed out last week, we wait for Bush and Blair to conduct an interview with Fox News entitled If We Did It, in which they spell out how they would have bungled this war if, indeed, they had done so.

So, just as Britain allegedly invaded for the good of the Iraqis, the timing of their departure will be conducted with them in mind. The fact that - according to the foreign secretary, Margaret Beckett - it will coincide with Blair leaving office in spring is entirely fortuitous.

More insidious is the manner in which the Democrats, who are about to take over the US Congress, have framed their arguments for withdrawal. Last Saturday the newly elected House majority leader, Steny Hoyer, suggested that the Americans would pull out because the Iraqis were too disorganised and self-obsessed. "In the days ahead, the Iraqis must make the tough decisions and accept responsibility for their future," he said. "And the Iraqis must know: our commitment, while great, is not unending."

It is absurd to suggest that the Iraqis - who have been invaded, whose country is currently occupied, who have had their police and army disbanded and their entire civil service fired - could possibly be in a position to take responsibility for their future and are simply not doing so.

For a start, it implies that the occupation is a potential solution when it is in fact the problem. This seems to be one of the few things on which Sunni and Shia leaders agree. "The roots of our problems lie in the mistakes the Americans committed right from the beginning of their occupation," Sheik Ali Merza, a Shia cleric in Najaf and a leader of the Islamic Dawa party, told the Los Angeles Times last week.

"Since the beginning, the US occupation drove Iraq from bad to worse," said Harith al-Dhari, the nation's most prominent Sunni cleric, after he fled to Egypt this month facing charges of supporting terrorism.

Also, it leaves intact the bogus premise that the invasion was an attempt at liberation that has failed because some squabbling ingrates, incapable of working in their own interests, could not grasp the basic tenets of western democracy. In short, it makes the victims responsible for the crime.

Withdrawal, when it happens, will be welcome. But its nature and the rationale given for it are not simply issues of political point-scoring. They will lay the groundwork for what comes next for two main reasons.

First, because, while withdrawal is a prerequisite for any lasting improvement in Iraq, it will not by itself solve the nation's considerable problems.

Iraq has suffered decades of colonial rule, 30 years of dictatorship and three years of military occupation. Most recently, it has been trashed by a foreign invader. The troops must go. But the west has to leave enough resources behind to pay for what it broke. For that to happen, the anti-war movement in the west must shift the focus of our arguments to the terms of withdrawal while explaining why this invasion failed and our responsibilities to the Iraqi people that arise as a result of that failure.

If we don't, we risk seeing Bono striding across airport tarmac 10 years hence with political leaders who demand good governance and democratic norms in the Gulf, as though Iraq got here by its own reckless psychosis. Eviscerated of history, context and responsibility, it will stand somewhere between basket case and charity case: like Africa, it will be misunderstood as a sign not of our culpability but of our superiority.

Second, because unless we understand what happened in Iraq we are doomed to continue repeating these mistakes elsewhere. Ten days ago, during a visit to Hanoi, Bush was asked whether Vietnam offered any lessons. He said: "We tend to want there to be instant success in the world, and the task in Iraq is going to take a while ... We'll succeed unless we quit."

In other words, the problem with Vietnam was not that the US invaded a sovereign country, bombed it to shreds, committed innumerable atrocities, murdered more than 500,000 Vietnamese - more than half of whom were civilians - and lost about 58,000 American servicemen. The problem with Vietnam was that they lost. And the reason they lost was not because they could neither sustain domestic support nor muster sufficient local support for their invasion, nor that their military was ill equipped for guerrilla warfare. They lost because it takes a while to complete such a tricky job, and the American public got bored.

"You learn more from a game you lose than a game you win," argued the chess great Capablanca. True, but only if you heed the lessons and then act on them.

g.younge@theguardian.com