General Sir Richard Dannatt's brave call for an early British withdrawal from Iraq contained one logical flaw. It did not apply to Afghanistan, he said, because foreign troops were invited by the Kabul government. This gave them a different status from coalition forces in Iraq, "which is why I have much more optimism that we can get it right in Afghanistan". It was an odd remark since US and British forces have a standing invitation from the Baghdad government. There is a clear parallel with Afghanistan, just as there is in his core arguments: Britain's presence in Iraq is exacerbating the security problems, and "we are in a Muslim country and Muslims' views of foreigners in their country are quite clear".
Both points apply to Afghanistan, where a combination of rising nationalism, impatience with Kabul's selection of corrupt governors, anger at the coalition's military tactics, and disappointment with its failure to improve basic services, is creating a tide of resistance. Afghan history shows that foreign interventionists, especially non-Muslims, only have a small window of time to show they are doing good. It runs out fast, particularly in the Pashtun south, the traditional heartland of opposition.
Five years after the Taliban were bombed out of power, Afghanistan is falling into the same morass of bloodletting as Iraq. The country is not riven by the sectarian conflict between Shia and Sunni that is fragmenting Iraq, but in every other way security has collapsed. A third of the country is "racked by violent insurgency", in Kofi Annan's words. Suicide bombings are on the rise, with 230 people killed last month; foreign contractors are kidnapped, police officers and government officials murdered.
The Taliban are resurgent. British forces are taking casualties in clashes that Brigadier Ed Butler, the outgoing commander of UK forces, calls more ferocious than anything in Iraq. A retired US general, Barry McCaffrey, reported this spring that, unlike Iraq's insurgents, the Taliban operate in battalion-sized units of 400 men, equipped with "excellent weapons and field equipment" and new technology for roadside bombs.
Britain and NATO are floundering over how to react. Lieutenant General David Richards, the NATO commander, believes in hitting the Taliban hard, using air and artillery strikes, even though they risk killing many civilians. "They think they can face us down. We will prove to them that they are defeatable," he said last week. The defence secretary, Des Browne, is more circumspect. Killing Taliban may provoke massive revenge, he recently warned: "There will be a real danger that their deaths will motivate others ... and potentially turn this into a conflict of a different kind."
The conflict's intensification reinforces the case, argued by a minority in the west after 9/11, that military attack would not solve the Taliban - or al-Qaida - problem. In Washington and London the desire to eliminate al-Qaida was wrongly combined with seeking regime change in Kabul - a goal the security council never authorised. A propaganda campaign demonised the Taliban so as to justify their removal as a victory, even though Osama bin Laden might not be found.
Afghanistan: the Mirage of Peace, an excellent study by Chris Johnson and Jolyon Leslie, two aid workers with long experience of working there, describes how under the Taliban security was better than it was before or after. In many regions they were flexible and pragmatic: humanitarian aid flowed, and girls' education continued in "home schools".
They also point out that the Bonn accords that followed regime change failed to provide for the demilitarisation of the warlords or a role for middle-ranking supporters of the Taliban. Just as the wholesale purge of all Ba'athists rather than just the leadership alienated an important sector of society in Iraq, ousting every Taliban follower created serious problems in Afghanistan, although the damage was different. People who joined the Ba'ath party out of necessity rather than conviction formed a crucial part of Iraq's professional class, including the army. In Afghanistan Taliban supporters were tribal and rural. But they represented a large swathe of the Pashtun population.
After Bonn they watched and waited. Had foreign troops and all the pledges of aid for Hamid Karzai's government produced quick benefits, Afghanistan's new deal might have stuck. Little was done, and the Taliban was able to regroup by arguing that Afghanistan was getting nothing from its new occupation. The drug barons used their money to stir up opposition. NATO's "hearts and minds" campaign in Helmand and other southern provinces this year came too late.
Two years ago Karzai brought some former Taliban leaders into the fold. A few were elected to parliament last year. But the only way to restore security in the Pashtun south is a comprehensive accommodation with tribal leaders, mullahs, former mujahideen, and the Taliban forces they are related to.
This is the tack Pakistan's Pervez Musharraf has been using in the troubled Pashtun provinces of Waziristan that border Afghanistan. After being bullied by Washington to use troops against the Taliban and their tribal supporters - a strategy that ended in failure - he has switched to making deals, withdrawing forces in return for undertakings of no Taliban attacks on Pakistani government buildings and no parallel administration. Religious scholars, tribal elders and Pakistani officials will monitor the deal.
Musharraf explained it last month in words that echo General Dannatt's: "On our side of the border, there will be a total uprising if a foreigner enters that area. We will never allow any foreigners into that area. It's against the culture of the people there."
There are encouraging signs that the message is getting through in Afghanistan. The best news for a long time was this week's decision by British troops to pull out of the Musa Qala district of Helmand. A ceasefire brokered by tribal leaders has brought peace on the Musharraf model. British officials claim the Taliban were not consulted. Perhaps not directly, but the tribal leaders will surely have talked to them, knowing that otherwise the deal would never work.
If this deal can be replicated throughout the south, there is hope. Britain and NATO will never achieve military victory or "pacify" Afghanistan. Local reconciliation and power sharing are the only basis on which job creation and rural development can at last go forward. In this task foreign armies have no place.
© Guardian News and Media Limited 2006.