It was clear before Julia Gillard's address this week that it is past time for Australia's role in Afghanistan to end. Now the only question is whether our 1550 troops depart quickly or depart slowly. In either scenario, Kabul's fate will ultimately be determined by the Afghan people once the US-led coalition forces turn tail and run. The omens are not good.

Outside fortified enclaves, security is as bad as ever. Hamid Karzai's government, riven with internal conflict and endemic corruption, is rotten to the core. Poverty, illiteracy, drug lords and tribal vendettas will continue to sap legitimacy from any central government.

The Afghan army and police are unlikely to sustain a war against the insurgents. But the Taliban will still command considerable support primarily in the Pashtun heartland of southern and eastern Afghanistan.

Besides, the Taliban will still live there when coalition forces depart. Karzai knows it, which is why he is talking with the Taliban leadership. And the Afghan people know it, too. As a leaked US intelligence report, The State of the Taliban, recently revealed, they are coming to grips with the return of their former rulers.

Meanwhile, Washington's meddling in Central Asia has damaged relations with nuclear-armed Pakistan and reinforced strident anti-Americanism in what Barack Obama once privately called ''the most frightening country in the world''.

To be sure, many objectives of the 2001 mission have been accomplished. Osama bin Laden is dead. The al-Qaeda leadership is decimated. And the terrorist threat Afghanistan once posed has been eliminated.

That is why President Obama and the Prime Minister will try to spin the war as some sort of victory. The truth, though, is that our longest campaign will end badly.

If success is defined as creating a viable democratic state and ending a war with security enhanced, then Afghanistan is an expensive failure. For it is not within the power of the US and its allies to impose lasting peace and prosperity in such an implacably alien society. Only a political settlement can help achieve such an outcome. And only Afghans can deliver, and keep, such a deal.

All of this is a reminder that Afghanistan, taken together with Iraq, has not only cost the US and its allies dearly in blood and treasure. It has also demonstrated the limits of what Robert Menzies called ''our great and powerful friend''.

In the aftermath of September 11, the conventional wisdom among political leaders on both sides of the Pacific was that the US should lead a coalition of willing states to not only end terrorism in but export democracy to the Middle East. Or in the words of one Bush adviser: ''We are an empire now, and when we act we create our own reality.''

That this view was widely held in the trauma following September 11 was understandable. That the rapid downfall of the Taliban tyranny in December 2001 and Saddam Hussein's regime in April 2003 gave it superficial credibility was unfortunate. That the Afghan and Iraq debacles have imposed tests that expose its falsity is good.

For both wars have shown that when it comes to defeating tribal warlords in mediaeval societies, even a global hegemon like the US can find itself wrong-footed and outwitted, not so much an eagle as an elephant.

I have been one of those who have argued for some time that even if the US-led coalition stayed for another decade, as the Prime Minister once suggested, we would still fail to remake Afghanistan into a Western-style democracy. But mine is hardly an isolated view among conservatives.

Many British Tories and US Republicans - and not just Ron Paul's followers - recognise that the days of a Pax Americana are over and that Washington will be more discriminating and selective in its foreign policy commitments.

The great British historian A. J. P. Taylor once said the road to hell is paved with good intentions. And there is no question the 2001 decision to invade Afghanistan and topple the turbaned tyrants who were in cahoots with the September 11 perpetrators was morally right and strategically sound.

But it's neither in our competence nor our interest to conduct a foreign policy based on the illusion democracy is an export commodity in the Muslim world. Too bad it's taken a quagmire in what is known as the "graveyard of empires" to shatter that ideal.

Tom Switzer is a research associate at the University of Sydney's United States Studies Centre and editor of Spectator Australia.