Around 400 BC the Celts settled Slovenia and formed the state of Noricum. In 10 BC, the Romans conquered Slovenia. Under Roman rule Slovenia prospered and towns were founded like Emona (Ljubljana), Celeia (Celje) and Poetovio (Ptuj). The Roman rule eventually ended in the 5th Century AD. In the 6th Century AD, the Slavs arrived in Slovenia and ruled until the 9th Century when Slovenia was absorbed into the Holy Roman Empire centred on Germany. In the 10th to 13th Centuries, Slovenia remained under German domination until the Hapsburg dynasty came to control Slovenia.
In the late 15th and 16th Century, peasants in Slovenia often rebelled. However, all the rebellions failed. In the early 16th century, Protestantism made some headway but by the Century's end, the Catholic Counter-Reformation reconverted Slovenia. The 18th Century was a prosperous time for Slovenia and the country flourished. In the late 18th century religious freedom was allowed and primary education was made compulsory. In the 18th century Slovenia was part of the Austro-Hungarian Empire. However, Napoleon wanted to cut Austria-Hungary off from the sea. So in 1809, he carved out an area he called the Illyrian Provinces. The Slovenian language was used in schools and in government. In 1814 with the defeat of Napoleon, Slovenia was absorbed back into the Austro-Hungarian Empire.
In 1848, Slovenians demanded an autonomous Slovenia and the use of the Slovenian language in schools and government. The emperor refused but during the late 19th Century, Slovenes formed political parties. However they wanted autonomy rather than outright independence. Then in 1918 with the end of the First World War, the Austro-Hungarian Empire disintegrated and Slovenes joined with Serbs and Croats to form a new state led by Serbian King Peter I. In 1929 the next king, Alexander, made himself absolute ruler and he renamed the kingdom Yugoslavia. However he was assassinated in 1934.
In March 1941 the regent signed a treaty with Germany but he was overthrown in a coup. In response, the Germans bombed Belgrade on 6 April 1941 and they invaded Yugoslavia. The conquered the country in a matter of days.
During the Second World War, Slovene partisans fought the Germans. However from 1943 some anti-Communists called the Slovenian Domobranci supported the Germans in order to prevent the spread of Communism. However they failed and in May 1945 Slovenia was completely liberated. Slovenia then became part of a Communist Yugoslavia led by General Tito. Industry developed and living standards rose. However many Slovenes resented the way resources were syphoned off from them and given to less prosperous parts of Yugoslavia. Tito died in 1980 and in the late 1980s, Yugoslavia began to break up. In 1990, a referendum was held on the issue of independence. The people were overwhelmingly in favour so on 25 June 1991, the Slovene parliament declared Slovenia independent.
In December 1991 Slovenia gained a new constitution and on 15 January 1992, Slovenian independence was recognized by the EU. Like many eastern European countries, Slovenia faced a painful transition from Communism to Capitalism during the 1990s. However, in 2004, Slovenia became a member of the EU. Also in 2004, Slovenia joined NATO. In 2007 Slovenia joined the Euro.