In recent times, a lot of the mess is our fault. Quick recap:
It was the west who trained, funded and armed the mujahidin during the Soviet occupation. The Taliban emerged very shortly after the Sov withdrawal, and were quickly one of the most hideously repressive and brutal regimes ever (Human Rights Watch was closely involved in monitoring - also the UN acknowledged about 15 massacres, including 4000 civilians slaughtered in Mazar-i-Sharif in 1998). the Taliban also controlled the outflow of narcotics - which by 2000 was estimated to account for about 75% of world supply. The perpetual state of factional/tribal war also made it easy for Bin Laden to establish The Base; and AQ and the Taliban co-existed well.
The international community only really took notice in September 2001 when two events happened: a) assassination of Massoud (9/9), leaving NA (and Afghanistan itself?) leaderless, and b) the attacks of 9/11, quickly established to have been by AQ, whose main home then was Afghanistan.
So the initial aims were: deal with terrorist camps (as there was no effective indigenous Govt so to do), deal with Taliban, ending civil war and thus establishing space for a more democratic society, and reduce narcotics trade.
That was nearly 10 years ago. None of these aims has yet been totally achieved, but has the west really done enough to leave behind an Afghanistan which is in a better state than when we invaded? What are the tasks that could/should be one by western forces? What does the Afghan Govt actually still want?
I caught something on the news today about this - I think it was British Army senior brass cautioning the politicians against premature or abrupt drawdown. I'll try to find links, but it seems they were concerned that if we left too precipitately, there was a significant risk the country really would descend swiftly to exactly where it was in 2000.
Now that really would be pointless.