RETURNING to Kabul after a long absence, your correspondent recalled an evening four years ago in the Afghan capital. It was spent in L’Atmosphère, a restaurant arranged around a swimming-pool and packed, as it usually was, with aid workers, contractors and spies. Cosmopolitan, high-spirited and well-paid, many had been whooping it up in Kabul for years: rebuilding Afghanistan was a blast. Against the trance music and chatter of ski trips to Bamiyan province, a wise Afghan hand looked about, and muttered: “This can’t go on.”

Most of the foreigners have left now, owing to shrinking aid budgets and rising insecurity. Those who remain mainly live in fortified compounds, invisible to most Afghans. Restaurants, bars and guesthouses have closed for want of business, especially since a Taliban suicide-bomb attack in January on another popular restaurant, Taverna du Liban, killed 18 foreigners. So thousands of cooks, drivers and translators—a source of goodwill for the chaotic international effort—have lost their jobs. “L’Atmos” is still open, but pitiably diminished; its supply of French food and wines having been withdrawn with the French peacekeepers who provided them.

The drawdown of the NATO force they were part of—from 130,000 troops a year ago to around 12,000 by the year’s end—is the main reason for the shrinking aid effort. To a degree, this represents a return to normality. With its promises of prosperity and gender equality, the reconstruction effort always appeared in pursuit of the unattainable. After the American invasion in 2001 it made vast early strides; under the Taliban, only 3% of girls went to school, now the UN estimates that more than one-third do. Yet progress has slowed considerably. Despite the intervention’s huge cost—estimated at a trillion dollars, or $30,000 for every Afghan—the country’s poverty rate has been stuck, at 36%, for almost a decade. It is even rising in places, such as north-eastern Afghanistan, which are relatively untouched by the Taliban insurgency that is ravaging most of the country.

Though generally optimistic, clued-up Afghans tend to take a more sober view of their prospects. Theirs is a violent and dysfunctional country. It is also the poorest in Asia and one of the world’s most corrupt. Despite the continuing threat of al-Qaeda, it is of diminishing interest to cash-strapped Western governments. It will take decades, not years, for the Afghans to build a half-decent state. This blast of realism would be depressing even if it did not happen to coincide with three urgent and intimately connected crises in the country’s politics, economy and security. Badly handled, these crises could reverse much of what has been achieved, or even revive Afghanistan’s grim past.

The first crisis is ebbing, at least. In September the two main disputants in June’s contested presidential election, Ashraf Ghani and Abdullah Abdullah, ended a four-month stand-off by agreeing on a power-sharing deal. This made Mr Ghani president and Mr Abdullah chief executive—in effect, prime minister. Early signs are that the pact could hold. The two men are former cabinet colleagues—respectively as finance minister and foreign minister. They share a pro-Western outlook and get on well in their thrice-weekly meetings. Neither is tainted by corruption. A healthy partnership between them could do great good; it could help reconcile Afghanistan’s deepest ethnic divide, between ethnic Pushtuns, Mr Ghani’s group, and Tajiks, who mostly support Mr Abdullah.

But it will be hard. Mr Ghani promised to form a new cabinet within 45 days of his induction, and replace other top officials from the corrupt regime of his predecessor, Hamid Karzai, in due course. That deadline has already slipped. The president is now urging Mr Abdullah to agree to a list of 15 new ministers—representing slightly over half the cabinet—ahead of a gathering of donor organisations in London on December 4th. Mr Ghani’s supporters attribute the delay to teething problems in a novel governing arrangement. It also reflects the difficulties that Mr Abdullah, in particular, faces in mollifying powerful backers. Persuading such individuals, including former Tajik warlords whose ties to the CIA allowed them to grab land and property in Kabul, to forsake the insecurity and corruption on which they have thrived will be Mr Ghani’s hardest task.

A former World Bank official, of prestigious nomadic Pushtun pedigree, Mr Ghani has the guts for it. But it is not clear, given fractures in his government and the gangsterism that infects an economy in which narcotics represent around 15% of output, whether he has the power. Unlike Mr Abdullah, Mr Ghani has no political party, which will be a disadvantage in the parliamentary elections that are due next year. To prevent his rival seizing control of parliament, Mr Ghani will continue campaigning. “I’m going to get around, it’s my lifeline,” he says, seated in the presidential palace in Kabul where Mr Karzai spent 13 years as a virtual recluse. “You know, nomads have a curse for their women: ‘May you be married in a city and live within four walls.’ The walls of this palace are not going to confine me.”

Political stability is essential not least for the economy. In the first post-Taliban decade, it grew at an annualised rate of 9%. With swelling tax receipts, government revenues rose from 3% of GDP in 2002 to a promising 11.5% in 2011. Yet two years of trepidation, over the election and insurgency, have caused economic havoc. Output is expected to grow by 1.5% this year, less than the population. As a result, the government expects a $500m hole in its budget, which it will beg donors to fill. In Shari Now park, central Kabul, the lean times are manifest in crowds of idle men, fighting partridges, playing board-games, or staring into space. Muhammad Akram, a 47-year-old father of four playing a local form of draughts, lost his job as a guard for a German NGO two years ago. Like many of the idlers, he is a fan of Mr Ghani. “But we need jobs and security and we are waiting to see if he can deliver.” With 400,000 new job-seekers each year, Afghanistan needs employment-generating growth. To reassure investors, Mr Ghani has promised a crackdown on corruption; he has already announced a plan to retry the main accused in the country’s biggest scam, the theft of almost a billion dollars from Kabul Bank. He also promises liberalising reforms: for example, to the land registry, in an effort to break the land mafia and spur construction. And he aims to cut spending that ballooned under Mr Karzai. “We’re paying 60,000 teachers, but we don’t know how many we actually have,” says a presidential adviser. “There could be 6,000.” Investors are encouraged. “When the private sector was getting completely fleeced under the previous government, it had no one to go to,” says Saad Mohseni, an Afghan media mogul. “We expect things to improve.” Mr Ghani dreams of relaunching Afghanistan as a trade hub, linking Central and South Asia and the Caucasus. He has high hopes for an endeavour by Afghanistan, Azerbaijan, Georgia and Turkey to boost regional trade and infrastructure along the ancient Silk Road—or Lapis Lazuli Corridor, as he calls it, referring to the deep blue gemstone for which Afghanistan is renowned. This is excellent; but it has no chance of success while Afghanistan remains locked in its third, most painful, struggle: against the Taliban.

Bearded and undaunted

The turbaned travellers at Hada Logar, a bus-stop on the southern edge of Kabul, are arriving from a war zone. “When we see a checkpoint on the road we don’t know if it is bandits, Taliban or soldiers,” says Muhammad Akbar, a jobless man from Mr Ghani’s ancestral Logar Province. He professes no love for the militants—“people only go to them because the government is weak”—unlike one of his companions, who gives his name as Mullah. “I am for anyone who is against the enemies of Islam,” he says. “In Logar the Taliban are the people. When you enter a village, you see their white flags flying. They do not want to fight, but the country has been occupied by Jews and Christians, so their struggle is just.”

Since NATO troops withdrew from the front line in June 2013, the 350,000-strong Afghan army has shown itself capable of planning operations and fighting hard. In the past two years it has lost over 9,000 men, nearly three times the number of Western troops killed in 13 years. Considering the army was scarcely formed four years ago—America and its allies having made little effort to raise Afghan troops before then—this is impressive. But it has not stopped the insurgency spreading.