Nato on Sunday held a ceremony in Kabul marking the end of its 13-year war in Afghanistan. A follow-up mission will focus on training the national army and police in the ongoing battle against the Taliban.

Here is a timeline of key events since 1979, when the Soviet Union invaded Afghanistan, beginning more than three decades of war:

1979-1989: Soviet occupation

In December 1979, Moscow opens a new front in the Cold War by sending troops into poor, mountainous Afghanistan to prop up a communist regime. The Afghan mujahideen resistance, backed by the West, fights the Soviet Army for a decade until it withdraws in February 1989.

1992-1996: Civil war

The fall of the communist government of president Mohammad Najibullah in 1992 unleashes a bloody power struggle between different factions that kills nearly 100,000 people in two years and destroys parts of Kabul. From 1994 the fundamentalist Taliban movement begins to emerge in the country’s south.

1996-2001: Taliban rule

The militants take power in Kabul in 1996 and install a regime based on a hardline interpretation of Islamic law, banning women from working and introducing stoning as a punishment. The Taliban, led by Mullah Mohammad Omar, become close to Al-Qaeda and shelter its leader Osama bin Laden.

2001: Western intervention

After the September 11 attacks, the US leads an invasion that topples the Taliban but fails to find bin Laden. Hamid Karzai is appointed to lead an interim government, and foreign donors inject billions of dollars to rebuild Afghanistan. Up to 130,000 soldiers are eventually deployed to help secure the country against the still-resilient Taliban, who carry on a bloody insurgency.

2004: First presidential election

In Afghanistan’s first presidential election based on universal suffrage, Karzai wins 55 percent of the vote on an enthusiastic turnout. The poll sees only limited violence and is followed a year later by provincial and parliamentary elections.

2014: Nato ends its war

Nato completes its handover of security to the Afghan army and police, who suffer a soaring death toll as the Taliban pursue an increasingly deadly guerrilla war against vulnerable government forces. New President Ashraf Ghani signs a deal allowing some US-Nato to stay on. Nato’s combat mission closes on December 31.

2015: Resolute Support

Nato’s follow-up mission, named “Resolute Support”, is set to focus on training the local security forces. About 10,600 US troops and 2,500 troops from Germany, Britain, Italy and other nations will make up the force. But the mission will shrink rapidly in size through the year, with half of the US troops due to leave by 2016. Ghani is expected to explore possible peace talks with the Taliban.