The Taliban swept across Afghanistan in just 10 days, taking control of towns and cities across the country.
Taliban fighters took their first provincial capital on 6 August - and by 15 August, they were at the gates of Kabul.
Their lightning advance prompted tens of thousands of people to flee their homes, many arriving in the Afghan capital, others heading for neighbouring countries.
And there was chaos in Kabul, as President Ashraf Ghani fled the country and thousands of his countrymen and women tried to do likewise.
US troops depart
Emboldened by the withdrawal of US and other international forces, in June, the Taliban already controlled large parts of the country.
But after 6 August, their advance accelerated with a new momentum.
Provincial capitals toppled in quick succession.
By 8 August, the Taliban had taken control in Kunduz.
Herat, Lashkar Gah and Kandahar followed within a few days.
Afghan forces collapse
Despite 20 years of outside support, billions of dollars of funding, an extensive programme of training and US air support, the Afghan security forces largely collapsed.
In some areas, they did stand and fight.
In Lashkar Gah, Afghan troops were pinned back in key positions, as the Taliban attacked repeatedly.
Hundreds of commandos were sent in to restore order - but when the Taliban detonated a massive car bomb outside the police headquarters, on 11 August, the battle was largely over.
In many areas, Afghan units that found themselves running out of ammunition and other supplies simply fled.
Troops armed and trained by the US to safeguard ordinary Afghans left them to largely fend for themselves.
And in some places, the authorities agreed to allow the Taliban to take over, to avoid further bloodshed.
In Ghazni, reports suggest the police chief and governor were both allowed to leave the city in return for agreeing to a Taliban takeover.
On 14 August, Mazar-i-Sharif fell to the Taliban, with little resistance from Afghan troops, some of whom left the city and headed for the border with Uzbekistan at Haraitan.
By the 15 August, 17,600 people fleeing the Taliban had arrived in Kabul, with thousands more arriving all the time, according to the UN's Office for the Coordination of Humanitarian Affairs.
With very little support from the Afghan authorities, many were sleeping rough in parks and other public areas.
Some said they had come from captured towns where the Taliban were killing male family members who had worked for the security forces, and reimposing restrictions on women.
The World Food Programme said the conflict had "all the hallmarks of a humanitarian catastrophe".
Chaos in Kabul
As President Ghani fled the country, US embassy staff were helicoptered out of their heavily fortified compound.
And thousands of people were heading to Kabul airport.
Taliban fighters initially paused outside the city, while emergency talks were held at the presidential palace.
But they then moved in to take full control.
Exactly how the Taliban intend to rule remains unclear - and may vary across the country.
Reports from inside Taliban-held territory so far give a mixed picture.
In Balkh, 20km (12 miles) from Mazar-i-Sharif, BBC News found women and girls allowed in public areas unaccompanied - but there were reports of a woman being murdered because of the way she had dressed.
In other places, including a rural northern district near the Tajik border, women have said they are now forced to cover themselves with a burka and cannot go out unaccompanied.
There are also reports of young women being offered to Taliban fighters for forced marriage.
Although, Taliban representatives in Qatar insist this is "a lie".
Additional reporting by Matt Murphy