In ancient times the region was inhabited by the Illyrian and Celtic tribes. In the 1st cent. B.C. they fell under the Roman provinces of Pannonia and Noricum. The region was settled in the 6th cent. A.D. by the South Slavs, who set up the early Slav state of Samo, which in 788 passed to the Franks. At the division of Charlemagne's empire (843) the region passed to the dukes of Bavaria. In 1335, Carinthia and Carniola passed to the Hapsburgs. From that time until 1918 Slovenia was part of Austria and the region was largely comprised in the Austrian crownlands of Carinthia, Carniola, and Styria. In 1918, Slovenia was included in the kingdom of Serbs, Croats, and Slovenes (called Yugoslavia after 1929), and in 1919 Austria formally ceded the region by the Treaty of Saint-Germain.
In World War II Slovenia was divided (1941) among Germany, Italy, and Hungary. After the war, Slovenia was made (1945) a constituent republic of Yugoslavia and received part of the former Italian region of Venezia Giulia. In early 1990, Slovenia elected a non-Communist government and stepped up its demands for greater autonomy with the threat of possible secession. In Feb., 1991, the Slovenian parliament ruled that Slovenian law took precedence over federal law. Slovenia declared independence on June 25, and federal troops moved in, but after some fighting withdrew by July. Slovenia, along with Croatia, was recognized as an independent country by the European Community and the United Nations in 1992.
Milan Kučan was elected president of Slovenia in 1990 and continued as president of the independent republic; he was reelected in Nov., 1997. In 2002, Janez Drnovšek, a Liberal Democrat, was elected president after a runoff election; Drnovšek had been the country's prime minister. Slovenia became a member of NATO and the European Union in 2004, and adopted the euro as its currency three years later. Janez Janša became prime minister in Nov., 2004, heading a center-right coalition government.
A dispute over Slovenia's right to access to the Adriatic through waters that Croatia claims has been a source of tension between the two nations, and has led Slovenia to block some of the negotiations for Croatia's accession to the European Union. The countries agreed in Aug., 2007, to submit their boundary disputes to the International Court of Justice, and in Sept., 2009, Slovenia ended the freeze on Croatia's accession talks after an agreement stipulated that none of the documents associated with EU application would have any legal impact on the resolution of the border dispute. The agreement was ratified by parliament in Apr., 2010, and was approved in a June, 2010, referendum.
In Nov., 2007, Danilo Türk, a former diplomat and left-of-center candidate, was elected to succeed Drnovšek as president. The opposition Social Democrats won a plurality in Sept., 2008, parliamentary elections, and in November party leader Borut Pahor became prime minister of the four-party coalition government. Pahor's government lost its majority in June, 2011, when one party left the coalition, and subsequently lost a confidence vote in September. In the Dec., 2011, elections, Ljubljana's mayor Zoran Janković led Positive Slovenia, a new center-left party, to a narrow plurality, but Jansa became prime minister in Jan., 2012, after forming a five-party center-right coalition.
In the 2012 presidential election Pahor defeated Türk in a December runoff; Türk was hurt by the country's severe recession and voter apathy (only 42% of the electorate voted). In Jan., 2013, Jansa's coalition lost its majority after he was accused of corruption (he was convicted later in the year), and his minority government lost a confidence vote the following month. A center-left coalition government, with Alenka Bratušek of Positive Slovenia as prime minister, was formed in March.