The area known as Croatia today was inhabited throughout the prehistoric period, ever since the Stone Age. In the area of Krapina, fossils of the Neanderthals have been unearthed dating to the middle Paleolithic. In the early Neolithic period, the Starčevo, Vučedol and Hvar cultures were scattered around the region. The Iron Age left traces of the Hallstatt culture (early Illyrians) and the La Tene culture (Celts). Much latter the region was settled by Liburnians and Illyrians, and Greek colonies were established on the islands of Vis (by the Dionysius I of Syracuse) and Hvar. In 9 AD the territory of today's Croatia became part of the Roman Empire. The Roman Emperor Diocletian built a massive palace in Split where he retired from politics in AD 305. During the 5th century the last Roman Emperor Julius Nepos ruled his small empire from Diocletian's Palace before he was killed in AD 480. The early history of Croatia ends with the Avar invasion in the first half of the 7th century and the destruction of almost all Roman towns. Surviving Romanised population escaped towards the islands and coastal towns, where it could set up strategically better defending points. The must famous of such established towns will became the city of Dubrovnik today.
The Croats arrived in what is today Croatia in the seventh century. They organized into two dukedoms; the duchy of Pannonian Croatia in the north and the duchy of Littoral Croatia in the south. For the most part, the Christianization of the settled Croats ended in the 9th century. Both duchies become Frankish vasals in late 8th century, and eventually become independent in following century. The first native Croatian ruler recognized by the pope was duke Branimir, whom Pope John VIII called dux Croatorum ("king of Croats") in 879. During the early 10th century the Pannonian Croatia was overrun by the Magyars, later being defeated by the duke Tomislav of Littoral Croatia who managed to unite the 2 duchies, and was crowned in 925 as the first king of Croatian kingdom. This crowning was later confirmed by the Byzantium which gave the king crown to Stjepan Držislav and pope crown to king Zvonimir. The medieval Croatian kingdom reached its peak during the reign of King Petar Krešimir IV (1058–1074). Following the disappearance of the Croatian ruling dynasty in 1091 Ladislaus I of Hungary brother of Jelena Lijepa last Croatian queen will become king of Croatia. Croatian nobility of Littoral opposed this crowning which has led to 10 years of war and the recognition of the Hungarian ruler Coloman as the common king for Croatia and Hungary in a treaty of 1102 (often referred to as the Pacta conventa). Kingdom of Croatia during personal union has never lost right to elect kings different from Hungarian had the ruling dynasty become extinct, and in 1293 and 1403 Croatia has chosen different kings, but both in cases the Kingdom of Hungary has declared war and personal union was again established. During next 4 centuries of personal union Kingdom of Croatia will be ruled by bans appointed by Hungarian king. Other consequences of the change to the Hungarian king included the introduction of feudalism and the rise of the native noble families such as Frankopan and Šubić. The later kings sought to restore some of their previously lost influence by giving certain privileges to the towns. The first period of personal union between Croatia and Hungary ended in 1526 with the Battle of Mohács and the defeat of Hungarian forces by the Ottomans. After the death of King Louis II, Croatian nobles at Cetingrad assembly decided to chose Habsburgs for new kings of Croatia under the condition that they give enough soldiers and money for the protection of Croatia against the invading Ottomans.
Shortly after the Battle of Mohács Habsburgs unsuccessfully sought to stabilize borders between the Ottomans and Kingdom of Croatia by creating a captaincy in Bihać, but in 1529 the Turks swept through the area, captured Buda and besieged Vienna, wreaking havoc throughout the Croatian border areas. After the failure of the first military projects, the Kingdom of Croatia was split into civilian and military halves in 1553. From the military half the Habsburgs have created Croatian and Slavonian Krajina and both will eventually become parts of the Military Frontier which was directly under the control of Vienna. Ottoman raids on Croatian territory lasted until 1593 and the Battle of Sisak after which borders stabilised -in the long-term. Kingdom of that time has become known under the name of Reliquiae reliquiarum olim inclyti Regni Croatiae ("The remains of the remains of the Kingdom of Croatia"). During the Great Turkish War Slavonia will was restored, but the hilly western Bosnia which has been a part of Croatia until the Ottoman conquest will never be restored and today's shape which resembles that of a crescent or a horseshoe is a remnant of this historical outcome. Southern part of the horseshoe was created with the Republic of Venice's conquests after the Fourth Crusade and during the 17-18th century wars with Ottomans. The official reason for this Venice expansion after the 15th century was the decision of the crowned king of Croatia, Ladislas of Naples, to sell his rights on Dalmatia to Venice in 1409. Must southern horseshoe part is created by Republic of Dubrovnik which is established in 1358 with Zadar Treaty in which Republic of Venice defeated by Croato-Hungarian personal union has left all coastal towns in Dalmatia. During next 450 years Dubrovnik will be trade republic with connections in all European and Mediterranean states and even will have colony in India. Republic will be annexed only in 1808 by Napoleon and today city is famous tourist attraction which is on UNESCO World Heritage Sites list. During more 2 century of Ottoman Wars Croatia will have great demography change. The Croats fled the Turks from the riverland areas of Gacka, Lika and Krbava, Moslavina in Slavonia and an area of present day Northern WesternBosnia towards Austria where they have stayed and the present day Burgenland Croats are direct descendants from these settlers. On place of escaping Croats Habsburgs have called Ortodox population of Bosnia and Serbia which will need to give military service in Croatian and Slavonian Krajina. First massive coming will be of Vlachs which will take a Serbian identity during first part of the 18 century.[8] and then of Serbs which will slowly come during 16 century, but mostly during Great Serb Migrations in 1690 and in 1737-39. Right and obligations of new population in Military frontier it will be decided with Statuta Valachorum in 1630.
In 1918 Croatia became a part of the Kingdom of SHS which was later renamed to Kingdom of Yugoslavia. In 1941-1945, during World War II, an Axis puppet state known as the Independent State of Croatia existed in service to the Nazi regime. Modern Croatia is created on AVNOJ anti-fascist partisans foundations during WWII, becoming a constitutive federal republic of the Socialist Federal Republic of Yugoslavia. In 1990, after holding the first democratic elections in the country, electoral won of the Croatian Democratic Union has been opposed by the municipalities with Serbian majority proclaiming autonomy and secession, starting in 1991 a rebellion which turned out to become a long and bloody war. The war was waged between the Croatian forces and the self-proclaimed Republic of Serbian Krajina helped by Serb-controlled Yugoslav People's Army. War finally ended in 1995 with Croatian victory and orders of the Republic of Serbian Krajina's leadership for immediate evacuation of all the population towards the Bosnia and Herzegovina. Croatia was internationally recognized on the January 15th, 1992, by the European Union and the United Nations, in a moment when it didn't have full sovereignty over more than 1/3rd of its territory. The first country to recognize Croatia was Iceland on December 19, 1991.