Afghanistan’s Taliban, who staged a lightning swift takeover this month, on Tuesday were celebrating the withdrawal of the last US troops after 20 years of military intervention in the country.
The hardline Islamists first governed the country between 1996 and 2001, imposing a strict interpretation of Islamic sharia law, before being ousted in a US-led invasion in the wake of the 11 September attacks.
Two decades of bitter insurgency later, they entered the capital and took control on 15 August.
Now, with the US military gone, they stand poised to form a government.
Here is how the Taliban staged that remarkable return to power:
In the early 1990s, with Afghanistan in the chaos and corruption of civil war, the Taliban movement was formed in the southern Afghan province of Kandahar.
Among its first followers were thousands of young Afghan refugees who studied a strict interpretation of Islam at Sunni madrassas in Pakistan.
The group takes its name from the Arabic word for student.
They were led by Mullah Omar, a one-eyed warrior-cleric who — like many of the Taliban — came from the powerful Pashtun ethnic group.
After Omar’s death in 2013, Akhtar Mansour briefly took over before being killed in a US drone strike.
Hibatullah Akhundzada became the supreme leader in 2016.
Dramatic rise to power
Promising to restore order and justice, the Taliban won early popular backing.
They drew substantial support from Pakistan, and initially had the tacit approval of the United States.
Equipped with tanks, heavy weapons and the cash to buy the support of local commanders, they steadily moved north, before capturing the capital Kabul on 27 September 1996.
President Burhanuddin Rabbani had already fled.
Taliban fighters dragged former communist president Mohammed Najibullah from a United Nations office where he had been sheltering, tortured him, and then hanged him in the street.
Reign of terror
The Taliban government imposed the strictest interpretations of sharia, establishing religious police for the suppression of “vice”.
Music, television and popular pastimes such as kite-flying were banned.
Girls’ schools were closed, while women were prevented from working. They were forced to wear an all-covering burqa in public.
Taliban courts handed out extreme punishments, including chopping off the hands of thieves and stoning to death women accused of adultery.
By 1998, they had control of 80 percent of the country, but were only recognised as the legal government by Pakistan, the United Arab Emirates and Saudi Arabia.
In 2001, they blew up 1,500-year-old giant statues of the Buddha in the central Bamiyan valley.
The Taliban allowed Afghanistan to become a sanctuary for Al-Qaeda, which set up training camps.
Mullah Omar lived in a house reportedly built for him by then Al-Qaeda chief Osama bin Laden.
The 11 September 2001 attacks in the United States, which left nearly 3,000 people dead, were immediately blamed on Al-Qaeda.
Accusing the Taliban of refusing to hand over Bin Laden, the United States and its allies launched air strikes on Afghanistan in October that year.
By early December, the Taliban government had fallen, its leaders fleeing to their strongholds in the south and east, or across the border into Pakistan’s tribal zone.
But while they were at first written off as a spent force, the Taliban rebuilt to lead an insurgency against the new Western-backed government in Kabul.
They made regular use of bombings and suicide attacks against the tens of thousands of foreign troops deployed as part of a US-dominated NATO force.
The NATO combat mission ended in December 2014, and the bulk of Western forces withdrew.
In July 2015, Pakistan hosted the first direct talks between Afghan and Taliban leaders, with support from China and the United States.
But talks collapsed after Mullah Omar’s death was revealed.
The rival Islamic State jihadist group emerged in Afghanistan in 2015, launching its own series of devastating attacks, mainly on Kabul.
US exit, Taliban offensive
In 2018, the United States and the Taliban began discreet talks in Qatar, which were interrupted several times after attacks against American troops.
But on 29 February 2020, a historic deal was signed in Doha between the administration of then US president Donald Trump and the Taliban, laying out a timetable for a full US troop withdrawal.
On 6 July 2021, the US military said it had completed 90 percent of its retreat from Afghanistan.
Five weeks later, the Taliban stormed into Kabul, and president Ashraf Ghani fled the country.
On Sunday, as the US wrapped up their retreat, the Taliban revealed Akhundzada was in southern Afghanistan, and planning to make a public appearance.
The Taliban leadership had said it would not announce a government until the full withdrawal of US forces, but that is now complete.