The Croats arrived in the area of present-day Croatia during the early part of the 7th century AD. They organised the state into two duchies by the 9th century. Tomislav became the first king by 925, elevating Croatia to the status of a kingdom. The Kingdom of Croatia retained its sovereignty for nearly two centuries, reaching its peak during the rule of Kings Peter Krešimir IV and Dmitar Zvonimir. Croatia entered a personal union with Hungary in 1102. In 1527, faced with Ottoman conquest, the Croatian Parliament elected Ferdinand I of the House of Habsburg to the Croatian throne. In 1918, after World War I, Croatia was included in the unrecognised State of Slovenes, Croats and Serbs which seceded from Austria-Hungary and merged into the Kingdom of Yugoslavia. A fascist Croatian puppet state existed during World War II. After the war, Croatia became a founding member and a federal constituent of Second Yugoslavia, a constitutionally socialist state. In June 1991, Croatia declared independence, which came into effect on 8 October of the same year. The Croatian War of Independence was fought successfully during the four years following the declaration.