The failure of Afghanistan's central government to deliver services and a functional economy opened a vacuum. The Taliban filled it and took over the functions of security, dispute resolution, and community policing, and bestowed a lucrative local farming industry - the poppy crop. "In Afghanistan," wrote the leading counterinsurgency expert David Kilcullen in 2009, "the government is losing to the Taliban, and it's losing because it's being outgoverned, not outfought." The Taliban did all manner of dreadful things, but that should not blind us to the political nature of the conflict. The US-led coalition in Afghanistan is conducting politics, too. In the immortal line of the Prussian strategist Karl von Clausewitz: "War is nothing more than the continuation of politics by other means." And more specifically, the Obama administration's decision to send a "surge" of 30,000 extra troops to Afghanistan was designed explicitly with a political aim in mind - to bring the Taliban to the negotiating table, on the terms that best suit the US. The US has been very clear that this was the intention. And Karzai has been in his own negotiations with the Taliban for more than a year.

Even if this were a conventional war, negotiations with the enemy would be unremarkable. "In war, a grand strategist, general or statesman, does not fix his final object at the destruction of the enemy," said the British general and strategist J.F.C. Fuller in 1929, "but at establishing a condition from out of which a better peace can be evolved." Even more so than in a conventional war, a counterinsurgency is about setting the terms for "a better peace". Unless the coalition intends to stay forever in Afghanistan and apply unlimited resources, it must set the terms for a post-occupation power structure. And the Taliban are one of the powers. If the coalition took a purist approach to deciding with whom it would negotiate, we certainly wouldn't be supporting the Karzai government, which stole last year's election through electoral fraud. We would be there talking only to ourselves. No, the remarkable feature of the news was this detail from Gates - that the US officials who have been conducting the talks for a few weeks now were not yet sure that the people on the other side were genuine representatives of the Taliban leader, Mullah Omar. So after a decade of shedding blood and spending treasure in Afghanistan, the US has no clear idea about the enemy leadership. In his handbook on counterinsurgency, Kilcullen, formerly an Australian officer before going to work for the US and now in private consultancy, listed the "Twenty-Eight Articles". It has become the Ten Commandments of counterinsurgency. And article number one says: "Know your turf. Know the people, the topography, economy, history, religion, and culture. Know every village, road, field, population group, tribal leader, and ancient grievance . . . Neglecting this knowledge will kill you." Some of the coalition forces, belatedly, took Kilcullen seriously and in the later years of the Afghan operation the Pentagon developed something called the "human terrain system", teams of well-informed local specialists. These teams have been highly effective.

But it seems that, at the very top, the US has failed to meet article one - flying blind, lost in a human terrain it does not understand or recognise. Last year NATO flew a supposed top Taliban commander to Kabul then discovered, to its embarrassment, that the man was an impostor. It seems little progress has been made since. An irony here is that the Taliban leader, Omar, has only one eye, yet it is the US, for all its cutting-edge electronic and satellite surveillance, that is having trouble seeing where it is going. For junior partners like Australia, this is not reassuring news. Yet it is not an argument for abandoning the struggle. The Afghan venture is a muddle. Yet the solution is not to withdraw in a panic. That would only worsen the muddle, betray local allies and sacrifice credibility. For Australia, a hasty pullout would also damage alliance credibility. Quite apart from the staunch public avowals of commitment from both Labor and Liberal leaders in Australia for the past decade, Julia Gillard also gave an unequivocal private assurance to Gates when he was last in Australia. When the Prime Minister hosted a dinner for Gates last November, she took him aside from the larger group into a tete-a-tete - known in US diplomatic jargon as a "pull-aside" - to give him an emphatic undertaking that Australia would be fully committed until the US-imposed end date of 2014, according to a senior US official who was present. It was such a firm promise, and so evidently heartfelt, that it made a real impression on Gates. There is no perfect solution in Afghanistan, only less-worse ways of setting it up for the future. Gates, who is about to retire, said at the weekend that real headway in any negotiations with the Taliban was unlikely until the northern winter: "I think that the Taliban have to feel themselves under military pressure and begin to believe that they can't win before they're willing to have a serious conversation."

A rush to the exits by any of the coalition countries would only weaken the negotiating position of the West and strengthen the Taliban. But with war fatigue building in Washington, it may be the US itself that has to strain to stay the course. Peter Hartcher is the Sydney Morning Herald's international editor. Follow the National Times on Twitter: @NationalTimesAU