'The Taliban think they've had a pretty good summer," said an American officer in Afghanistan last week. The western sponsors of President Karzai's government, by contrast, have had a rotten one. The country is producing a bumper opium harvest, significant Nato casualties and mounting cynicism about the corruption of the Kabul government.

Many people in Europe and the United States share the view so vividly expressed by Simon Jenkins in these pages, that the sooner we shake Afghanistan's dust from our feet and leave its people to decide their own fate, the better. Some influential strategy gurus on both sides of the Atlantic assert that, five years after 9/11, the western strategy of pursuing Islamist terrorists into their breeding and training grounds has proved disastrous and counter-productive. It is better, they argue, to fight terrorism in our own countries than to try to do so amid alien cultures, where the west is far out of its depth.

It is hardly surprising that such sentiment is widespread, when the American and British governments have bungled and lied so consistently in both Iraq and Afghanistan. Simon Jenkins and I, along with more important people, predicted sorry consequences from dispatching a small British force, ill-equipped with ground and air mobility, to Helmand province. Nothing has happened since May to discredit such forecasts.

Other big Nato members, such as Germany, France and Italy, have behaved far worse than Blair. They have sent troops to Afghanistan not to fight, but to play out a charade of solidarity. It is widely said that the Afghan deployment is a key test of whether Nato can remain a serious organisation. The omens are not auspicious. Almost five years after invading Afghanistan, the west knows pitifully little about the place. Hardly any Nato soldiers, diplomats or intelligence officers speak its language. Electronic surveillance helicopters hover over the battlefields overloaded with interpreters. An American officer observes that the tribal structure down around the Pakistan border is extraordinarily complex, "and we don't really understand it at all". Nato guesses that there are 6,000-8,000 Taliban operating inside Afghanistan, but nobody knows how many more are in waiting.

The Pakistan government's acknowledgement last week of defeat in Waziristan, and its consequent military withdrawal from the province, represents a grave blow to efforts to stabilise Afghanistan. The Taliban now possess huge safe havens, "a sort of giant Dundalk", in the words of a British officer recalling the IRA's border stronghold in the Irish Republic two decades ago.

Nato strategy is founded upon a belief that most Afghans dislike having their villages and fields turned into battlegrounds. Western commanders want local people to recognise that the quickest way to get rid of unwanted foreign troops is to discourage the Taliban from engaging them.

This aspiration may well prove fanciful, because it underrates the strength of the Afghan warrior culture. I remember once interviewing Sir Edgar Williams, the distinguished Oxford academic who spent the war as Montgomery's head of intelligence. Williams said that he and his civilian comrades, masquerading in uniforms for an unwelcome season, were irked by the contrast between their own attitude to the war and that of their enemies: "We just wanted to get this whole thing over and go back to our proper lives. But the Germans didn't seem to mind doing it indefinitely."

This is even more true of the Afghans. Almost every man in the country has fighting experience, and takes pride in his prowess. The British in Helmand hope to separate the so-called hardcore Taliban from their hangers-on, local tribesmen who are paid piece-rates of $10 or $20 a day for joining a given attack on western forces.

Yet the Americans, who have been in eastern Afghanistan much longer than other Nato contingents, believe that the pool of Taliban fighters is almost unlimited. They no longer expect military victory. They are pinning their hopes on lavish civil reconstruction efforts, together with quickly "deepening the Afghan footprint" - an extension of authority by the Kabul government and its embryo army. "If you gave me a choice between having two more battalions of troops here, or another $50m for building roads, I'd take the money," says a senior US officer.

Unfortunately corruption is booming among the supporters of President Karzai. As everywhere in the Muslim world, this promotes popular anger which threatens to discredit secular democracy. The Taliban are paying their fighters about double the rates on offer to the Afghan national army. The police force scarcely functions at all. Whatever military successes Nato achieves, it will be several years before the Kabul government is capable of exploiting them effectively to widen its political control.

After reciting this litany of woe, it may seem logical to join the chorus of those urging that we should quit forthwith. I find it impossible to do this. The consequences of abandoning Afghanistan to mediaeval anarchy are so ghastly that it seems essential for the west to persevere, however poor the prospects.

The British army remains convinced that it can succeed, given adequate resources. Some senior soldiers feel deeply frustrated that it is impossible to get reinforcements to Helmand, where they might make a real difference, because so many men, armoured vehicles and helicopters are committed in southern Iraq, where their presence can no longer alter the country's fate.

It seems essential for the west to narrow its ambitions in Afghanistan merely to frustrating the return of the Taliban. An American officer declares proudly that there are now 6 million Afghan children in schools, including 2 million girls. It is appalling to contemplate the prospect that if the fanatics regain power, the absolute subjection of women will be restored.

Yet it seems impossible for westerners to aspire to transform the entire culture of the country, simultaneously with eradicating opium and beating the Taliban. President Karzai will never govern his country successfully on a western democratic model. Whatever form of rule evolves there, in western eyes it is unlikely to be pretty. The best we can hope is that it will prove less ugly than that of the Taliban.

If the west fails, a heavy responsibility will rest with Germany, France and Italy, which pretended to be willing to contribute yet refused to act with conviction. We should surely forget past blunders and address ourselves solely to the future. If the Karzai regime cannot be sustained, unspeakably barbaric Islamist fascists will regain power in Kabul. This would be a triumph for al-Qaida, a disaster for the global struggle against terrorism, and consign the Afghan people once more to the dark ages.

There are very few optimists in Kabul today. Yet it seems essential for the world to keep trying there. There is still a chance of success, as there is not in Iraq. Western purposes are far more honourable. Our disgust towards Bush and Blair should not blind us to the fact that not all their purposes are dishonourable.