What you need to know:
- President George W. Bush launches his "war on terror" in response to the September 11 attacks that killed around 3,000 people, with air strikes on Afghanistan on October 7, 2001.
With the Taliban back in control of Afghanistan, here is a recap of landmark events in the war-torn country since the group's first regime was toppled in the 2001 US-led invasion:
2001: 9/11 and 'War on Terror'
President George W. Bush launches his "war on terror" in response to the September 11 attacks that killed around 3,000 people, with air strikes on Afghanistan on October 7, 2001.
The Taliban government had sheltered Osama bin Laden and his Al-Qaeda movement, which masterminded 9/11.
In power since 1996, the Taliban are soon defeated and flee the Afghan capital Kabul on December 6.
Hamid Karzai is appointed to lead an interim government and NATO begins to deploy its International Security Assistance Force.
2004: First presidential election
Afghanistan's first election under a new system is held on October 9, 2004 with an enthusiastic turnout of 70 percent. Karzai wins 55 percent of the vote.
The Taliban regroup in the south and east, as well as across the border in Pakistan, and launch an insurgency.
2008-2011: US reinforcements
As attacks multiply, the US command in 2008 asks for more troops and the first reinforcements are sent.
Karzai is re-elected on August 20, 2009 in elections that are marred by massive fraud, low turnout and Taliban attacks.
In 2009, President Barack Obama, who had campaigned on a pledge to end the Afghanistan war, doubles the number of US troops to 68,000. In 2010, it reaches around 100,000.
Osama bin Laden is killed on May 2, 2011 in a US Special Forces operation in Pakistan.
On June 22, Obama announces the beginning of a troop withdrawal, with the departure by mid-2012 of 33,000 soldiers.
2014: NATO exit
In June 2014, Ashraf Ghani is elected president but voting is marred by violence and a bitter dispute over claims of fraud.
In December, NATO ends its 13-year combat mission but a number of troops remain to train the Afghan military.
The following year, the Taliban make their greatest military advances since being ousted.
The Islamic State jihadist group also becomes active in the region. Bloody attacks multiply, notably in Kabul.
2020: US-Taliban deal, disputed election
Ghani is declared victorious for a second term on February 18, 2020, an announcement rejected by his rival and former minister Abdullah Abdullah, who vows to form his own parallel government.
On February 29, the United States and the Taliban sign a historic deal in Doha under which all foreign forces would leave Afghanistan by May 2021, provided the insurgents start talks with Kabul and adhere to other security guarantees.
A power-sharing deal ends the bitter Ghani-Abdullah feud in May. Abdullah takes the role of leading the peace negotiations.
Talks begin in September but violence surges and the Taliban are blamed for a wave of targeted killings.
May 2021: Foreign troops withdrawal
On May 1, 2021 the United States and NATO start withdrawing their 9,500 soldiers, of which 2,500 are American.
In May, the Americans withdraw from the Kandahar air base.
On July 2, Bagram air base -- Afghanistan's biggest, and the nerve centre of the US-led coalition's operations -- is handed over to Afghan forces.
President Joe Biden says that the US troop withdrawal will be completed by August 31, before the 20th anniversary of the 9/11 attacks.
May-August 2021: Taliban blitz
The insurgents launch lightning attacks across Afghanistan, capturing vast stretches of the hinterland as the final foreign troops begin their withdrawal.
The Taliban capture their first provincial capital, Zaranj in the southwest, on August 6.
Other major cities fall within days, including Kandahar and Herat -- Afghanistan's second- and third-biggest cities respectively.
Most of the north, west and south is under Taliban control by August 13.
The Pentagon says Kabul does not appear to face an "imminent threat".
August 2021: Fall of Kabul
The insurgents fully encircle the capital on August 15 with the capture of Jalalabad in the east.
It leaves Kabul as the only city under government control.
Diplomatic missions scramble to evacuate officials and local staff who fear reprisals from the Taliban.
Ghani flees the country, reportedly to Tajikistan, and the Taliban enter Kabul, eventually taking position in the presidential palace.
In a statement, Ghani admits the insurgents have "won".