The following is an outline of the series of events that led up the War in Afghanistan (2001–2021).

Origins (1978–1992)

Afghanistan's strategic position in Asia has led to its repeated failed invasion, so much so that it is called the "graveyard of empires". The British spent a century trying to control it starting in 1838, with disastrous results. Eventually the British acknowledged they could not directly control the country and installed a semi-puppet regime in 1879. Afghanistan regained its independence in 1919 and was under monarchical rule thereafter.

Afghanistan's political order began to break down in the 1970s. First, Mohammed Daoud Khan seized power in the July 1973 Afghan coup d'état, where the monarchy was overthrown in favor of an autocratic republic. Daoud Khan was then killed in the April 1978 Saur Revolution, a coup in which the communist People's Democratic Party of Afghanistan (PDPA) took control of the government, ushering in 40 years of conflict. PDPA pushed for a socialist transformation by abolishing arranged marriages, promoting mass literacy and reforming land ownership. This undermined the traditional tribal order and provoked opposition across rural areas. The PDPA's crackdown and execution of thousands of political prisoners was met with open rebellion including the 1979 Herat uprising. PDPA was beset by internal leadership differences and was affected by an internal coup on 11 September 1979 when Hafizullah Amin ousted Nur Muhammad Taraki. The Soviet Union, sensing PDPA weakness, invaded three months later, to depose Amin.

The entry of Soviet forces in Afghanistan in December 1979 intensified the Cold War and prompted the Soviet rivals, the United States, Pakistan, Saudi Arabia and China to support rebels fighting against the Soviet-backed Democratic Republic of Afghanistan. In contrast to the secular and socialist government, which controlled the cities, religiously motivated mujahideen held sway in the majority of the countryside. The CIA worked with Pakistan's Inter-Service Intelligence to funnel foreign support for the mujahideen. The war also attracted Arab volunteers known as "Afghan Arabs", including Osama bin Laden.

After the withdrawal of the Soviet military from Afghanistan in May 1989, the PDPA regime under Mohammad Najibullah held on until 1992 when the dissolution of the Soviet Union deprived the regime of aid and the defection of general Abdul Rashid Dostum cleared the approach to Kabul. The mujahideen took control of Kabul on 16 April 1992, removed Najibullah from power and proclaimed the founding of the Islamic State of Afghanistan.

Civil war and the rise of the Taliban (1992–1996)

With multiple factions vying for power, the country dissolved into warlordism in April 1992, precipitating civil war. Nominally the president was Burhanuddin Rabbani, but he had to fight for control of the country, starting with Kabul. The battle between warlords was one of the most brutal periods of the 40 years of conflict. Kabul, which had escaped war before, became ground zero. Some 25,000 civilians were killed. Atrocities were widespread. From this came the Taliban.

The Taliban emerged from religious students known as the Talib who sought to end warlordism through stricter adherence to religious Sharia law. In October 1994, Mohammed Omar, a mujahideen member who taught at a Pakistani madrassa, returned to Kandahar and formed the largely Pashtun Taliban movement. The anarchy of the country, especially the frequent rape, robbery, and murder, outraged the Taliban. By November 1994, the Taliban had captured all of Kandahar Province. They declined the government's offer to join in a coalition government and marched on Kabul in 1995.

The Taliban's early victories in 1994 were followed by a series of costly defeats. Pakistan "provided strong support" to the Taliban. Analysts such as Amin Saikal described the group as developing into a proxy force for Pakistan's regional interests which the Taliban denied. The Taliban started shelling Kabul in early 1995, but were driven back by Massoud. On 27 September 1996, the Taliban, with military support by Pakistan and financial support from Saudi Arabia, seized Kabul and founded the Islamic Emirate of Afghanistan.

Taliban Emirate vs. Northern Alliance

The Islamic Emirate of Afghanistan was recognized only by Pakistan, Saudi Arabia, and the United Arab Emirates. The Taliban imposed their fundamentalist Deobandi interpretation of Islam in areas under their control, issuing edicts forbidding women to work outside the home, attend school or to leave their homes unless accompanied by a male relative. According to the Pakistani expert Ahmed Rashid, "between 1994 and 1999, an estimated 80,000 to 100,000 Pakistanis trained and fought in Afghanistan" on the side of the Taliban.Peter Tomsen said that up until 9/11, Pakistani military and ISI officers along with thousands of regular Pakistani armed forces personnel had been involved in the fighting in Afghanistan.

Ahmad Shah Massoud emerged as a major player in the war; he was nominally the minister of defense under President Rabbani. Massoud and warlord Dostum, former arch-enemies, created a united front against the Taliban, the Northern Alliance. In addition to Massoud's Tajik force and Dostum's Uzbeks, the United Front included Hazara factions and Pashtun forces under the leadership of commanders such as Abdul Haq and Haji Abdul Qadir. Abdul Haq also gathered a number of defecting Pashtun Taliban. Both agreed to work together with the exiled Afghan king Zahir Shah. The Northern Alliance received varying degrees of support from Russia, Iran, Tajikistan and India. The Taliban captured Mazar-i-Sharif in 1998 and drove Dostum into exile.

According to the United Nations (UN), the Taliban, while trying to consolidate control over northern and western Afghanistan, committed systematic massacres against civilians. UN officials stated that there had been "15 massacres" between 1996 and 2001. The Taliban especially targeted the Shia Hazaras. In retaliation for the execution of 3,000 Taliban prisoners by Uzbek general Abdul Malik Pahlawan in 1997, the Taliban executed about 4,000 civilians after taking Mazar-i-Sharif in 1998.

By 2001, the Taliban controlled as much as 90% of Afghanistan with the Northern Alliance confined to the country's northeast corner. Fighting alongside Taliban forces were some 28,000–30,000 Pakistanis (usually also Pashtun) and 2,000–3,000 Al-Qaeda militants. Other Pakistani nationals fighting in Afghanistan were regular soldiers especially from the Frontier Corps but also from the Pakistani Army providing direct combat support.

Al-Qaeda In August 1996, bin Laden was forced to leave Sudan and arrived in Jalalabad, Afghanistan. He had founded his international Al-Qaeda network in the late 1980s to support the Mujahideen's war against the Soviets but became disillusioned by infighting among warlords. He grew close to Mullah Omar and moved al-Qaeda's operations to eastern Afghanistan, a safe haven as he was under the protection of the Taliban there.

The 9/11 Commission in the US found that under the Taliban, al-Qaeda was able to use Afghanistan as a place to train and indoctrinate fighters, import weapons, coordinate with other jihadists, and plot terrorist actions. While al-Qaeda maintained its own camps in Afghanistan, it also supported training camps of other organizations. An estimated 10,000 to 20,000 men passed through these facilities before 9/11, most of whom were sent to fight for the Taliban against the United Front. A smaller number were inducted into al-Qaeda.

After the August 1998 United States embassy bombings were linked to bin Laden, President Bill Clinton ordered missile strikes on militant training camps in Afghanistan. US officials pressed the Taliban to surrender bin Laden. In 1999, the international community imposed sanctions on the Taliban, calling for bin Laden to be surrendered. The Taliban repeatedly rebuffed these demands.

Central Intelligence Agency (CIA) Special Activities Division paramilitary teams were active in Afghanistan in the 1990s in clandestine operations to locate and kill or capture Osama bin Laden. These teams planned several operations but did not receive the order to proceed from President Clinton. Their efforts built relationships with Afghan leaders that proved essential in the 2001 invasion.

Change in US policy toward Afghanistan During the Clinton administration, the US tended to favor Pakistan and until 1998–1999 had no clear policy toward Afghanistan. In 1997, for example, the US State Department's Robin Raphel told Massoud to surrender to the Taliban. Massoud responded that, as long as he controlled an area the size of his hat, he would continue to defend it from the Taliban. Around the same time, top foreign policy officials in the Clinton administration flew to northern Afghanistan to try to persuade the United Front not to take advantage of a chance to make crucial gains against the Taliban. They insisted it was the time for a cease-fire and an arms embargo. At the time, Pakistan began a "Berlin-like airlift to resupply and re-equip the Taliban", financed with Saudi money.

US policy toward Afghanistan changed after the 1998 US embassy bombings. Subsequently, Osama bin Laden was indicted for his involvement in the embassy bombings. In 1999 both the US and the United Nations enacted sanctions against the Taliban via United Nations Security Council Resolution 1267, which demanded the Taliban surrender Osama bin Laden for trial in the US and close all terrorist bases in Afghanistan. The only collaboration between Massoud and the US at the time was an effort with the CIA to trace bin Laden following the 1998 bombings. The US and the European Union provided no support to Massoud in the fight against the Taliban.

By 2001 the change of policy sought by CIA officers who knew Massoud was underway. CIA lawyers, working with officers in the Near East Division and Counter-terrorist Center, began to draft a formal finding for President George W. Bush's signature, authorizing a covert action program in Afghanistan. It would be the first in a decade to seek to influence the course of the Afghan war in favor of Massoud.

A change in US policy was effected in August 2001. The Bush administration agreed on a plan to start supporting Massoud. A meeting of top national security officials agreed that the Taliban would be presented with an ultimatum to hand over bin Laden and other al-Qaeda operatives. If the Taliban refused, the US would provide covert military aid to anti-Taliban groups. If both those options failed, "the deputies agreed that the United States would seek to overthrow the Taliban regime through more direct action".

Massoud's assassination on the eve of 9/11

Ahmad Shah Massoud was the only leader of the United Front (Northern Alliance) in Afghanistan in 2001. In the areas under his control, Massoud set up democratic institutions and signed the Women's Rights Declaration. Massoud's tolerant government prompted up to a million refugees to flee from the Taliban to areas under his control.

In early 2001, Massoud and several other Afghan leaders addressed the European Parliament in Brussels, asking the international community to provide humanitarian help. The Afghan envoy asserted that the Taliban and al-Qaeda had introduced "a very wrong perception of Islam" and that without the support of the Pakistani government and Osama bin Laden, the Taliban would not be able to sustain their military campaign for another year. Massoud warned that his intelligence had gathered information about an imminent, large-scale attack on US soil.