The short answer
The US and its partners removed the Taliban from power in late 2001, but they did not destroy the movement. The group regrouped, and within a few years it was fighting an insurgency across much of the country. No single reason explains why, but several factors come up again and again.
Safe havens across the border
Many officials and analysts pointed to safe havens in Pakistan’s border regions. Taliban leaders could rest, organize and recruit there, and attacks could be launched into Afghanistan and withdrawn. Pakistan’s government denied backing the Taliban, and the question remains disputed. Either way, a group that can retreat across a border is hard to defeat with forces inside one country.
A weak Afghan government
The Afghan government struggled to extend its authority beyond the big cities. Corruption, uneven local governance and a security force that depended on foreign support made it hard to hold areas after foreign troops cleared them. When coalition forces left a district, the Taliban often moved back in.
A mission whose goals shifted
The mission began as a counterterrorism effort to deny al-Qaeda a base. Over time it became a counterinsurgency and a project to build a national government and army. Critics argued that these goals were broader and harder to reach, and that the timelines did not match the work required.
Politics and war fatigue
Public support for the war in the United States and in allied countries fell over the years. The 2009 surge brought more troops, but it was followed by a drawdown. In 2020, the Doha agreement set a timetable for withdrawal and opened talks between the Taliban and the Afghan government. The Taliban took control of the country in August 2021, while the withdrawal was still underway.
Why there is no single answer
Historians and officials tend to weigh these factors differently. Some stress the border sanctuaries, others the weakness of the Afghan state, and others the changing goals of the mission. For a fuller account of how the war developed, read the history of NATO in Afghanistan.