Events that took place centuries ago are as personal to many Serbs as if they happened last week. The history of present-day Serbia is defined by foreign invasions, from the time the Celts supplanted the Illyrians in the 4th century BC followed by the arrival of the Romans 100 years later and the Slavs in the 6th century AD.

Enter the Ottomans

Medieval Serbia flowered under the Nemanjić dynasty from the second half of the 12th century. It was recognised as a kingdom in 1217 during the rule of Stefan Prvovenčani, whose brother Sava became the first archbishop of the independent Serbian Orthodox Church. The 'golden age' was reached during Stefan Dušan's reign as emperor (1346–55).

Serbia declined after his death, and at the pivotal Battle of Kosovo in 1389 – much mythologised in Serbian national consciousness – the Turks defeated the Serbs, ushering in nearly 500 years of Islamic rule. Early revolts were crushed, but the 1815 uprising led to de facto independence that became complete in 1878 under the Obrenović royal dynasty.

During the Balkan Wars (1912–13), the Ottomans were driven out of present-day North Macedonia and Kosovo and these territories were incorporated into the Kingdom of Serbia.

The Land of South Slavs

On 28 June 1914, Austria-Hungary used the assassination of Archduke Franz Ferdinand by Bosnian Serb Gavrilo Princip in Sarajevo as cause to invade Serbia, sparking WWI: almost 60% of Serbia's male population (or a quarter of its total population) perished. In 1918 – emerging victorious from WWI – the Kingdom of Serbia and Kingdom of Montenegro united with the former Austro-Hungarian territories of present-day Croatia, Slovenia, Bosnia & Hercegovina (BiH), plus Serbia's modern-day Vojvodina province, to form the Kingdom of Serbs, Croats and Slovenes under the rule of the Serbian Karađorđević dynasty. The country was renamed Yugoslavia (Land of South Slavs) in 1929.

An anti-Axis coup in March 1941 led to the Nazi bombing of Belgrade and the German occupation of Serbia. Royalist Četniks and communist Partisans fought the Germans, Croatia's pro-Nazi, genocidal Ustaše regime and each other, with Josip Broz Tito's Partisans finally gaining the upper hand. In 1945 they formed the government, abolished the monarchy and declared a federal republic including Serbia and its two autonomous provinces, Kosovo and Vojvodina.

Tito broke with former ally Stalin in 1948, and in 1961 founded the nonaligned movement. Within Yugoslavia, growing regional inequalities and burgeoning Serbian expansionism fuelled demands for greater autonomy. Tito's death in 1980 signalled the beginning of the rise of nationalism, stifled but long-simmering, within the republics.

The Yugoslav Wars

By 1986 Serbian nationalists were espousing a 'Greater Serbia', an ideology that would encompass Serbs from all republics into one state. Appropriated by Serbia's Communist Party leader Slobodan Milošević, the doctrine was fuelled by claims of oppression of Serbs by Kosovo Albanians, leading to the abolishment of self-rule in Kosovo in 1990. Croatia, Slovenia, BiH and Macedonia seceded from the federation, sparking a series of violent conflicts known collectively as the Yugoslav Wars.

Bitter, bloody and monstrously complex, the wars – Slovenia's Ten-Day War, the Croatian War of Independence and the Bosnian War – were fought not just between breakaway forces and the majority-Serb Yugoslav National Army and paramilitaries, but along fractious ethnic and religious lines as well. Due to the Milošević regime's role in the conflict and support for Croatia's Krajina Serbs and Bosnia's Republika Srpska, between 1992 and 1995 Serbia was under UN sanctions. The embargo had a devastating impact on the country's economy and caused rampant hyperinflation (the highest in the world), a flourishing black market and mass migration, particularly of highly educated young people.

In April 1992 the remaining republics, Serbia and Montenegro, formed the rump Yugoslav federation without provision of a satisfying level of autonomy for Kosovo given its Albanian majority. The guerrilla Kosovo Liberation Army was formed and violence erupted in 1998. In March 1999 peace talks failed when Serbia rejected the US-brokered Rambouillet Agreement (which called for an international military presence in Kosovo). In response to organised resistance in Kosovo, Serbian forces cracked down on its Albanian population, galvanising the US and NATO into a 78-day bombing campaign; hundreds of thousands of Albanians fled to Macedonia and Albania. On 12 June 1999 Serbian forces withdrew from Kosovo. The bombing resulted in still unconfirmed numbers of civilian deaths, destruction of industrial and transport infrastructure and large-scale environmental pollution.

European Dawn

In the 2000 presidential elections, opposition parties led by Zoran Ðinđić and Vojislav Koštunica declared victory, a claim denounced by Milošević. Opposition supporters from all over Serbia swarmed Belgrade and stormed the Parliament. Milošević had to acknowledge defeat and Koštunica became the new president. Serbia restored ties with Europe and rejoined the UN. In April 2001, Milošević was arrested and extradited to the international war crimes tribunal in The Hague; he died in prison in March 2006.

In 2003, a loose union of Serbia and Montenegro replaced the rump Yugoslavia. The next year, Serbia was shaken by the assassination of reformist Prime Minister Zoran Ðinđić – who had been instrumental in overthrowing Milošević and extraditing him to The Hague – by members of an organised crime group. In June 2004, Serbia gained a new president in pro-European Boris Tadić. In May 2006, 55% of Montenegrins voted for independence from Serbia and the union was abolished. In February 2008, the EU- and NATO-controlled Kosovo province declared independence, a move that Serbia holds to be illegal.

In the 2012 elections, Tadić lost the presidency to Tomislav Nikolić, a former member of the far-right Serbian Radical Party. In 2014 and 2016, Aleksandar Vučić was elected prime minister. A former ultra-nationalist member of the Serbian Radical Party, Vučić about-faced and joined the more liberal Serbian Progressive Party in 2008. In 2017, Vučić succeeded Nikolić as president, and Serbia gained a new prime minister in Ana Brnabić – the first female and first openly LGBT head of government in Serbia.