THE blast annihilated the back of the Humvee, leaving a smear in the desert. “Every time we venture that far out, we get hit,” says Captain Aaron Tapalman of the US Army, who is responsible for Sabari district in Afghanistan's Khost province, near the border with Pakistan. The roadside bomb had exploded under the Afghan army vehicle, killing two soldiers and seriously wounding three.

Khost lies across infiltration routes from Pakistan's tribal areas, but much of the insurgency is local. “Most of the villages just want to be left alone, and some of them are clearly pro-Taliban,” says First Lieutenant Eddie Fox in neighbouring Bak. His outpost is often pummelled by rocket fire. The influence of the Haqqani network—eastern Afghanistan's leading insurgent organisation—is strong. They are said to have been behind a number of terrorist attacks in Khost and operate there as a mafia. Many local leaders are hedging their bets. “To be frank, we are afraid of both sides,” says a man in a nearby village.

In a place like Sabari, the efforts of the 140,000 troops of ISAF (NATO plus a coalition of the willing) look distinctly unpromising. American forces there are struggling to expand their “security bubbles”—the relatively secure zones around coalition bases. These intensively patrolled patches often cover only a dozen or so square kilometres in the most hostile parts of the country.

Yet for David Petraeus, the American general in command of ISAF, keeping watch on the country from his gloomy office in Kabul, Sabari is an example of where the coalition has finally “got the inputs right”. His argument is that the extra troops ordered to Afghanistan in late 2009 by Barack Obama have allowed ISAF to move into troublesome areas like this for the first time. They have also put the cost of the military effort up to eye-watering levels. The American army alone is spending nearly $120 billion a year.

“No one denies the progress that has been achieved in the security arena in the last six to eight months,” the general says. Certainly the American reinforcements have changed the face of the war. In many difficult areas of Helmand and Kandahar ISAF's forces have become much more aggressive. A senior NATO intelligence officer says the troop surge, together with an “unprecedented” increase in night raids by special forces against mid-level Taliban leaders, has left the insurgents dazed. Huge numbers of weapons caches have been destroyed, and it is hoped that Taliban fighters attempting to reinfiltrate for the summer fighting season will struggle to win local support.

NATO's electronic eavesdropping and networks of informants have discovered that some Taliban commanders are afraid to return to the fight, and have had flaming rows with senior insurgents directing fighting from the safety of Pakistan. One piece of intelligence even suggests that Mullah Omar himself, the one-eyed leader of the Taliban, is deeply alarmed by the rapid expansion of the Afghan Local Police (ALP), an auxiliary patrol force supervised by American Special Forces. So far 39 units are up and running and 37 in the pipeline. General Petraeus says there is “no question” that the ALP is making a big impact, although critics fear that this “militia” may inevitably turn on the population it is supposed to serve.

According to the general, some insurgent groups are also increasingly interested in a reintegration programme under which fighters give up their arms in return for an amnesty and some vocational training. But so far just 1,200 have gone through the programme, mostly in northern Afghanistan, with another 1,700 considering it: a drop in the ocean in an insurgency estimated to be 35,000 strong. NATO does not expect local peace deals to have any effect until the end of the year.

Meanwhile, violence is relentlessly rising. NATO analysts predict that 2011 will be the most violent year ever, with incidents possibly up by 30%. Nic Lee, director of the Afghanistan NGO Safety Office, sees “a perpetually escalating stalemate”. But General Petraeus is sanguine about this, too. He attributes the rising level of violence to the fact that the extra Afghan and NATO troops have provided “100,000 more targets than last year”. He also highlights a decline in “complex attacks” involving more than one assailant (see chart). Is it a turning point? “This is something you see in the rear-view mirror, not through the windshield,” he says.

Talking to the Taliban

Yet with a large population of young men living over the border in Pakistan and radicalised by what one Afghan official describes as “hate madrassas”, some fear that the supply of potential insurgents is almost limitless. For Hanif Atmar, a former interior minister, as long as the Taliban enjoy such sanctuaries, “they cannot be defeated”. Many agree, and think that the only way forward is for America to enter peace talks with the Taliban.

In February Hillary Clinton publicly committed the United States to a “diplomatic surge” to bring the conflict to an end. Some Taliban apparently found this confusing, just as the military surge was increasing pressure on them. Nonetheless, around the country ISAF is already showing enthusiasm for engaging with local Talibs. In Ghazni, a province in the south-east suffering some of the worst violence in the country, the education director sat down with the local Taliban earlier this year to thrash out what should be taught in schools—agreeing in the end, surprisingly, to keep the official curriculum unchanged.

Some analysts think the killing of Osama bin Laden has opened a window of opportunity. “The Taliban know they made a lot of serious mistakes in their government, using the Islamic faith in the wrong way,” says Ahmad Shah Ahmadzai, a former prime minister in the mujahideen government of the 1990s that was later overthrown by the Taliban. “They have made a lot of corrections. They will not be a threat to anybody.”

Even the Pakistanis may, some think, support talks. The Pakistani ambassador in Kabul still laughingly denies the suggestion that the Taliban is anything other than an Afghan phenomenon; but for everyone else it is an accepted fact that Pakistan promotes the Afghan Taliban in order to avoid the emergence of a strong state backed by India (see article). According to Afghan officials, Pakistan explicitly laid out the “price of peace” in a recent meeting between Yusuf Raza Gilani and the Afghan president, Hamid Karzai, with the Pakistani leader urging his counterpart to abandon his alliance with America and the West in favour of stronger ties with its neighbour and with China.

Now the thinking is that the Pakistanis may change their tune if the coalition continues to batter the Taliban for a bit longer. “It may be that Pakistan is thinking to itself, ‘If we are not careful we are going to find that one of our main assets is actually eroding before our eyes, so maybe we'd better start talking',” said one diplomat.

Yet this seems, in the end, a forlorn hope. There are precious few signs that the Taliban are ready to talk, despite strenuous efforts to engage them by Mr Karzai. Acting on advice from ministers of the former Taliban regime, he has set up a High Peace Council to make contact with the insurgents, and has tried to arrange the release of Taliban prisoners held on the basis of flimsy intelligence. He is also trying to find a country outside the region that could host a Taliban “office” where they could meet the government and NATO representatives without fear of arrest. But despite all these overtures, no positive response has come from Mullah Omar.

And even if the Taliban show willing, the obstacles in the way of a politically acceptable settlement are formidable. Only last week at least 10,000 protesters, waving green flags, mobilised in Kabul to protest against “dealmaking” with the Taliban. It was an impressive display of power by Amrullah Saleh, the country's articulate former intelligence chief, and his “anti-Taliban constituency”—a group apparently dominated by non-Pushtun northerners, who fought hardest against the rise of the Taliban in the 1990s. Mr Saleh hints that peace with the Taliban could mean the remobilisation of northern factions that were supposedly disarmed after 2001. “Don't push me to take a gun,” he said after the rally. “It is very simple.”

The Russian ambassador in Kabul, Andrey Avetisyan, who served as a political officer during the Soviet occupation, thinks any attempt to make a quick deal could end in “civil war”. Reconciliation, he says, must be done very carefully, and a final deal may take years.

Training up the Afghans

Even if peace talks fail to offer a quick way out for the West, and General Petraeus's campaign fails to deliver a killer blow to the insurgency, the vast majority of ISAF troops will nonetheless leave by the end of 2014. What happens then?

According to the country's “transition” plan, the Afghan National Army (ANA) and police (ANP) will be expected to take the lead in providing security all over the country by the end of 2014. The National Military Hospital in Kabul is full of young soldiers and policemen, lying listlessly on their beds or learning to walk with prosthetic legs, who have sustained horrific injuries but still say they are proud to have served their country. Can these patriotic Afghans do the job NATO's high-tech armies were unable to finish?

Mr Atmar, the former interior minister, does not think it is as hopeless as it sounds. Put crudely, it has been done before: in 1989, when the Soviet army pulled out of Afghanistan. Remarkably, the regime they left behind managed to hold on to power for more than three years—and this at a time when the rebel mujahideen were far more popular than the Taliban are now (only 13% of Afghans view them favourably, according to the UN). The regime would never have fallen, Mr Atmar says, if the vast subsidies on which his forces relied had not dried up when the Soviet Union collapsed. For Mr Avetisyan this is the “biggest lesson” of the Soviet occupation.

The annual cost of Afghan security forces after 2014 has been estimated at $6 billion-8 billion. Adding to that huge cost will be the expense of the continuing Western military mission, which will include special forces and “enablers” to help the Afghans with such things as intelligence. Numbers have not yet been decided, but David Barno, a former commander of American forces in Afghanistan, has recommended a “sustainable limited presence” of between 25,000 and 35,000 men.

This presence will also, it is hoped, persuade many insurgents and meddling neighbours that they cannot wait out the foreigners. But Mr Atmar points out that the Soviets “invested properly” in the Afghan army, kitting it out with more tanks, planes and helicopters than most other countries in the region. By contrast, the Americans “only decided that Afghanistan needed an air force last year.” They have to invest more in Afghan capacity and damn the cost, he argues. But they will also have to stay, in part, to restrain this well-stocked new army from attacking its neighbours.

The Americans recognised the need to invest more about 18 months ago, when William Caldwell, an American general, took charge of the NATO Training Mission. When it began, it had two nations and 30 trainers; it now has 32 nations and more than 1,300 trainers. Asked whether the Afghans will be ready to take over security in 2014, General Caldwell says: “Unequivocally, yes.” The army, police and air force combined are now 285,000-strong; by December 305,000 should be trained and in the field. Attrition rates have declined; the police and the army now get 6,000-9,000 recruits every month, and keep most of them. And although only 14% of new recruits can write their names, General Caldwell hopes that the literacy rate in the Afghan forces will have improved to around 60% by the end of the year.

Much of the security of greater Kabul, where a fifth of Afghans live, is already largely in the hands of Afghans, including Afghan special forces who conduct up to three raids a night. Even the sustained attack on May 7th-8th in Kandahar city was mostly put down by Afghan security forces. The reduction in foreign troops could help damp down the war; some Taliban foot soldiers have said they would not fight against fellow Afghans as they do against the infidel invaders.

The non-rule of law

The abiding problem is that Mr Karzai remains in charge. His relations with the Americans are now soured by years of mutual mistrust, and it hard to imagine that he can hold everything together. “He has disowned this war for reasons of political expediency and personal grievances,” says one of his former cabinet colleagues. “He will never forgive the Americans, and they won't forgive him.”

In theory Mr Karzai is meant to step down in 2014, after two terms. In practice he may bend the constitution and stay. And although there have been some modest improvements in the way Afghanistan is governed, the country as a whole remains mired in corruption. ISAF's funding is vast compared with the size of the Afghan economy, and much of that money sloshes dangerously around inside the country. Large sums go to contractors who may pass them on to the Taliban, or to drug-runners, to pay for supplies and protection, especially in the south. The rule of law is patchy: many Afghans shun government courts, preferring the swifter, cleaner justice of informal Taliban tribunals.

Nation-building, brick by brick

The writ of the Afghan government extends much further than in the days when Mr Karzai was dismissed as “the “mayor of Kabul”. But although an army of civilian experts was promised to help reinforce the Afghan government, little has been achieved. “The Obama civilian surge has been a complete failure,” says one American official working in the south-east, who complains that none of the promised half-dozen experts in agriculture, rule of law and development ever turned up. Either they were not recruited, or they were “stuck in Kabul or Bagram”. One project that got off the ground in the city of Ghazni was an 80-metre ornamental barrier built down the centre of a road by USAID for $100,000. The governor was so unimpressed that he built another 80 metres for $10,000 just to prove a point.

Ministers in Kabul and governors in the provinces still do not work well together, with provincial officials constantly complaining about the difficulty of getting money from the capital. In the most violent provinces governors struggle to compete with tribal power-brokers, fat on the profits of drug-smuggling and military contracts. District governments often have no operating budget to pay for staff and basic supplies, even assuming there is an office for the governor and his team to sit in. In Sabari the governor is so scared of assassination that he rarely appears, and 50 of the 53 government positions are unfilled.

If things work at all it is usually because of Provincial Reconstruction Teams (PRTs), the civilian-military units run by individual ISAF countries. In Helmand the PRT runs the “District Delivery Programme”: the British government lodges $9m of aid with the Ministry of Finance in Kabul, which officials in Helmand then ensure is spent on district government through a mixture of “persuasion and encouragement”, in one official's words. It took nine months for the first penny of the $9m to get down to district level.

Mr Karzai constantly criticises the PRTs as an “alternative structure” outside his government. In February he called for them to be closed down. But “all the governors I speak to say that without the PRTs nothing would happen in their provinces,” says one exasperated UN official.

Settling for less

In Pushtun areas of Afghanistan especially, the Karzai government is seen as an intruding and corrupt foreign power: Persian-speaking Kabulis backed up by white foreigners. Captain Steve Baunach, a civil-affairs adviser in Khost, says his task is to convince people to support the government instead of the Taliban. “But I'm struggling because I don't have a convincing story to tell them. There are not enough police, no budget, no services.” Besides, local Pushtu tribes have always governed themselves. Some NATO advisers think a genuine local government could be built up based on tribal organisations; but after decades of war the tribal system, too, is in a pitiful state, with some elders locked in conflict over land and women.

Western officials are under no illusions that Afghanistan can become a 21st-century state. Attacks by insurgents are likely to continue for years to come. But Simon Gass, NATO's senior civilian representative in Kabul, thinks “the question is, can they be contained by the Afghan security forces, with whatever extra help they need, in a way that makes sure this level of violence does not pose a threat to the existence and authority of the Afghan state? That is what we are looking for and I think it is achievable.” A messy transition to Afghan control looks the most likely, and least worst, outcome.

Back in Khost Colonel Chris Toner, the man in charge, is also cautiously optimistic. He points out that the surge has only just started there. He says some tribes are co-operative. In Jaji Maidan district, locals keep the Taliban out. For all the violence in Sabari, the outpost has suffered far fewer attacks than last year. Colonel Toner says enemy control of the province has weakened since 2010. There is a long way to go; but, slowly, they may be getting there.