The Slavic people known as the Croats are first known to have dwelt in the Carpathian Mountains, but migrated to the region of present-day Croatia in the first half of the seventh century under the leadership of the brothers Kosentzis and Chrobatos. There they formed two independent states in Dalmatia and Pannonia, which were united in 916 by Tomislav I. Tomislav later became the first King of Croatia, and expanded his kingdom in the face of opposition from the Romans, Bulgaria, Magyars and Franks to include all of the present day country.
Croatia was later united with neighbouring Hungary under the Árpád dynasty, and also with Romania. Under Roman rule the kingdom lost much of its independent identity and was treated as a province like any other. In 1632 the Croatians revolted, in the midst of a period of conflict across the region known as the Danubian Wars, and their independence was recognised in 1677 with the Treaty of Ragusa.
The Croatians elected Archduke Ladislaus von Holleischen, brother of King Louis of Bohemia, as their new king. In 1664 Ladislaus' son, Matthias II, succeeded to the thrones of Austria and Bohemia as well, thus bringing Croatia into the network of countries known as the Holleischen realms. The country however retained its separate identity as well as its own laws, customs and politics. This lasted until 1907 when, in the midst of the Second World War, popular revolt all across the Holleischen lands resulted in the deposition of the family from all their thrones and the division of the realms.
Some countries, such as Austria, became republics after the fall of the Holleischen, but Croatia instead opted to find a new monarch from a different family. In 1909, therefore, Prince Trpimir of Bulgaria was elected king by the Sabor and has accession was ratified by a plebiscite. His great-great-granddaughter, Queen Jasenka II, is head of state to this day. Croatia joined the Central side during the Third World War, but was defeated and occupied early on. The government never surrendered, however, and resistance movements continued to operate against the occupiers all through the conflict. The country was liberated in 1963 and was aided in its recovery by extensive reparations at the war's end.