The territory of contemporary Slovenia has a rich history, with the earliest evidence of human habitation dating back roughly 250,000 years.
The first state on this territory was formed by Celtic tribes in the 4th and 3rd centuries BC. The Roman Empire annexed their state around 10 BC.
The next centuries saw invasions of the Huns and Germanic tribes until Slavs finally came to dominate the area. In the 14th century, most of the territory was taken over by the Habsburgs. They retained control right up to the end of the First World War.
Reformation spread across Slovenian territory in the middle of the 16th century and helped create the foundations of the Slovene literary language.
The birth of the Slovenian nation in the modern sense of the word can be traced back to the reign of Emperor Joseph II (1765–1790). That was the time of the introduction of compulsory education and primary education with Slovenian as language of instruction, as well as of cultural-linguistic activities by Slovenian intellectuals.
Napoleon captured parts of the present-day Slovenian territory, along with parts of present-day Croatia, and created the Illyrian Provinces adjoined to the French state, with Ljubljana as the capital. The short-lived French rule (1809-1813) improved the position of the Slovene language in schools but did not abolish feudalism.
In 1867, the Austrian Empire was transformed into the dual Austro-Hungarian monarchy. Most of the territory of the present-day Slovenia was retained in the Austrian part of the monarchy.
After Austro-Hungarian defeat in the World War I, an independent state of Slovenes, Croats, and Serbs was formed in 1918, quickly succeeded by the Kingdom of Serbs, Croats, and Slovenes. The latter became the Kingdom of Yugoslavia in 1929.
During World War II, the Kingdom of Yugoslavia disintegrated, and Slovenian territory was divided between Germany, Italy, and Hungary.
In 1941, the Liberation Front of the Slovenian Nation was founded in Ljubljana, and it launched armed resistance against the occupying forces. At the end of the war, the partisan army liberated the whole of ethnic Slovenia which became the People’s Republic of Slovenia and a constitutive part of the Federal People’s Republic of Yugoslavia.
By 1947, all private property had been nationalised. After the break with the Soviet Union in 1948, Yugoslavia began with a milder version of socialism based on common ownership and self-management.
Following the death of the long-time president Josip Broz Tito in 1980, the economic and political situation deteriorated, and this ultimately led to the end of Yugoslavia ten years later.
On 23 December 1990, 88% of Slovenia's voters supported independence that was formally declared by the Republic of Slovenia on 25 June 1991.
The very next day, the Yugoslav Army attacked the newly formed state. A truce was called after a ten-day war, and in October 1991, the last soldiers of the Yugoslav Army left Slovenia.
The European Union recognised Slovenia in January 1992. The United Nations accorded its membership in May 1992. In 2004 Slovenia joined NATO (on 29 March) and the European Union (on 1 May). It became part of the Eurozone on 1 January 2007. In 2010, Slovenia also joined the OECD.