Twenty years ago, a US-led coalition invaded Afghanistan in order to topple the Taliban, but in the past six days the insurgents have captured most almost all of the country and look set to declare control - how has the situation deteriorated so quickly?
Most of the cities taken by the Taliban have been seized in the last week, but the situation has been deteriorating for months and began to get worse in April when President Joe Biden announced the final withdrawal of US troops from the country.
How did we get here?
After the 9/11 bombings in 2001 the US sent an ultimatum to the Taliban-controlled Afghan government demanding they hand over Osama Bin Laden and dismantle militant training camps in the country or face invasion.
The Taliban refused and the US invaded the country backed by British forces. The first UK troops arrived in Afghanistan in November 2001 when Royal Marines from 40 Commando helped to secure Bagram airfield. By December 2001, the Taliban had been toppled.
Most major combat operations ended in 2003 but by 2006 with the war in Iraq occupying US attention militant attacks began resurging.
In 2014, American and Nato troops formally ended their combat mission, transitioning to a support and training role, but soon after the Taliban begin retaking large areas of the country.
In 2020, the US and the Taliban signed a deal in Qatar confirming the withdrawal of 13,000 US troops still in Afghanistan and committing the insurgents to halt attacks on Americans.
By April 2021 peace talks between the Taliban and the government had completely failed and President Biden announced the withdrawal of the final 2,500-3,500 US troops.
The 20-year war in Afghanistan saw hundreds of UK personnel suffer life-changing injuries, with more than 450 deaths recorded.
What's happened recently?
Since President Biden made the announcement in April a bad situation for the Afghan government has turned into a perilous one. Here's what's happened in recent months:
May 4, the Taliban launches an offensive across the country focusing on the southern Helmand province.
May 11, the Taliban capture Nerkh, just outside Kabul and fighting intensifies across the country.
June 7, more than 150 Afghan soldiers are killed in less than 24 hours as the government begins to lose ground.
June 22, the fighting spreads to the north, away from the Taliban's traditional strongholds in the south of the country and they seize several districts.
July 2, the US pulls out of the Bagram airbase - once the centre of all US operations in the country - without telling their Afghan counterparts. US ground operations in Afghanistan effectively come to an end.
August 6, a new rapid offensive by the Taliban begins and they claim their first provincial capital, Zaranj, in the south of the country.
August 7, another provincial capital, Sheberghan, in the north falls to the Taliban.
August 8, the Taliban seize control of three more provincial capitals in the north, Sar-e-Pul, Taloqan and the large and strategically important city of Kunduz.
August 9, Aybak, another provincial capital, in the north is taken by the Taliban.
August 10, provincial capital Pul-e-Khumri falls to the Taliban.
August 11, the northern provincial capitals of Fayzabad falls to the Taliban in the north while they also seize control of Farah in the west.
August 12, Afghanistan's second and third largest cities, Kandahar and Herat, were captured just hours after the takeover of Ghazni. Lashkar Gar city was also taken.
August 14, The Taliban captured Logar province, including its capital Pul-i-Alam. The province is just south of Kabul. It also captured Mazar-e-Sharif - a large, heavily defended city in northern Afghanistan.
August 15, The insurgents entered the presidential palace in the capital of Kabul and said they would soon declare the Islamic Emirate of Afghanistan. President Ashraf Ghani also left the country for neighbouring Tajikistan. The insurgents also seized Jalalabad, the capital of Nangarhar province.
What is the situation now?
Afghanistan looks set to be under Taliban control in a matter of hours.
Part of the problem for the Afghan forces is that it is overstretched, many of the regular forces have fled from the fighting and collapsed leaving most of the fighting to the air force and the army's elite units.
The US is only operating airstrikes in the region, with all ground operations done by the government or local militias who back the government.
But these forces have proved ineffective, with the Taliban saying they've taken many cities without a fight.
Mr Ghani had recently traveled to Balkh to negotiate with local warlords in order to acquire their help against the Taliban. But many of them have surrendered to the Taliban or fled, leaving the president without a military option.
Footage from Kunduz in Afghanistan shows the city falling to the hands of the Taliban
Families have flowed into Kabul living in parks and streets with little food or water.
Some civilians who have fled Taliban advances have said the insurgents imposed repressive restrictions on women and burned down schools.
There have also been reports of revenge killings in areas where the Taliban have gained control.The international community continues to hold out hope for a return to peace talks, US envoy Zalmay Khalilzad brought a warning to the Taliban on Tuesday that any government that comes to power through force in Afghanistan will not be recognised.