Slavic ancestors of the present-day Slovenians settled in the area in the 6th century. The Slavic Duchy of Carantania was formed in the 7th century. In 745, Carantania lost its independence, being largely subsumed into the Frankish empire. Many Slavs converted to Christianity.
The Freising manuscripts, the earliest surviving written documents in a Slovenian dialect and the first ever Slavic document in Latin script, were written around 1000. During the 14th century, most of Slovenia's regions passed into ownership of the Habsburgs whose lands later formed the Austro-Hungarian Empire, with Slovenians inhabiting all or most of the provinces of Carniola, Gorizia and Gradisca, and parts of the provinces of Istria, Carinthia and Styria.
In 1848 a strong programme for a united Slovenia emerged as part of the Spring of Nations movement within Austria.
With the collapse of the Austro-Hungarian monarchy in 1918, Slovenians initially formed part of the State of Slovenes, Croats and Serbs, which shortly joined the Kingdom of Serbs, Croats and Slovenes, later renamed (1929) the Kingdom of Yugoslavia. Following the re-establishment of Yugoslavia at the end of World War II, Slovenia became a part of the Socialist Federal Republic of Yugoslavia, officially declared on 29 November 1945. Present-day Slovenia was formed on 25 June 1991 upon its independence from Yugoslavia. Slovenia joined NATO on 29 March 2004 and the European Union on 1 May 2004. Slovenia will hold the Presidency of the Council of the European Union in the first half of 2008, being the first "new" member state to do so