AMID the wreckage of broken promises and failed plans that litter the ten-year mission in Afghanistan, the only certainty has been the campaign's capacity to disappoint. Rotten government, a vast cost, resurgent Taliban and the mounting death toll all argue that this is a patch of dusty ground where the outside world has overstayed its welcome. Now the killing of Osama bin Laden has at last satisfied one of the war's chief aims. Barack Obama is to assess troop levels in Afghanistan as part of a long-scheduled drawdown in July. Why shouldn't America's president declare victory and pull out fast?

Tempting as it is, that would be a mistake. The coalition has set the end of 2014 as the deadline for the Afghan government to take charge of security. That is still the date to aim for, because it gives scope for an Afghanistan that will be broadly stable. In July Mr Obama can certainly pull out a few thousand of the 90,000 or so troops he has there, to meet his pledge. But for the outside world rapidly to withdraw military and financial support would invite collapse inside Afghanistan and strife across the region. History has shown where that leads.

In the past presidents pondering what to do in Afghanistan needed either to put in more resources or to stomach a humiliating retreat. But Mr Obama is not being asked to double up; just to stick to a decent plan. As our briefing this week explains, the country is certainly not set to become the 21st-century democracy that the West dreamed of a decade ago—where girls go to school and women are free of the burqa; nor is it likely to have shed violence and corruption by 2014. But it is on course to becoming a markedly better place than it was, with the chance eventually of peace with the Taliban, steady relations with its neighbours and better treatment of its citizens.

The improvement is partly thanks to the “surge” of 30,000 troops, which Mr Obama reluctantly endorsed in 2009. The extra forces, under General David Petraeus, America's most successful serving commander, have helped to dampen the insurgency. It also reflects better governors and civil servants in some parts. And it is thanks to the Afghan army and police, who now number 285,000 and are better trained and educated than they were. Just this week, they put down a raid by at least 40 Taliban gunmen and suicide-bombers in Kandahar.

Two worries present themselves. The immediate one is that these gains are fragile. The summer will surely bring a resurgence in fighting by the Taliban. Government in some regions remains dire. Corruption is ubiquitous—witness the recent escape by at least 475 Taliban from a jail in Kandahar. All this argues both for making the troop withdrawal this year largely symbolic and for training still more Afghan security forces.

The second worry is what happens in 2014—or soon afterwards. The puppet government that the Russians left behind in 1989 collapsed three years later. But that regime was not overwhelmed by the insurgency: it was abandoned by the bankrupt Soviet Union. An Afghan government could see off today's insurgents, who are weaker, worse armed and less popular. Although support for the Taliban is high in some regions, only 13% of all Afghans back them. Even if many Taliban resist a political settlement right now, a stable, inclusive government in Kabul might gradually persuade them to peel off.

That is why even after 2014 Afghanistan will need 25,000-35,000 foreign troops and aid of several billion dollars a year. This would be a serious commitment, but it would be a fraction of the $120 billion that the United States alone has provided this year. And foreign troops would play a supporting role, in which they faced less danger and were more removed from the contact with Afghan civilians that has fed the insurgency.

Much could go wrong. President Hamid Karzai is supposed to give up power in 2014. Corrupt and weak, he might seek to hang on. That would be as big a setback as his rigged re-election in 2009. The outside world needs to bolster the presumption that Mr Karzai will go. Worse still is the threat from Pakistan (see article). Its security forces cannot be trusted. Even so, America must hold its nose and engage with Pakistan and press it to act against the Taliban. Some influence is better than none at all; and some Pakistanis are starting to realise that the Islamists they sponsor in Afghanistan feed terror at home.

Hard but necessary

In short it is all connected. Abandon Afghanistan to the wolves and you increase the chance of Pakistan sliding still further downwards. By contrast, the more America stabilises Afghanistan, the more that helps steady the region too. From the view of 2001, none of this looks like victory in Afghanistan. But compared with the power vacuum and disruption created by suddenly pulling out, it would be a triumph.