around 72% of the territory of the Kingdom of Hungary, which was ceded to Czechoslovakia, the Kingdom of Romania, the Kingdom of Serbs, Croats and Slovenes, the First Austrian Republic, the Second Polish Republic and the Kingdom of Italy. Afterwards a short-lived People's Republic was declared. It was followed by a restored Kingdom of Hungary, but was governed by a regent, Miklós Horthy. He officially represented the Hungarian monarchy of Charles IV, Apostolic King of Hungary, who was held in captivity during his last months at Tihany abbey. Between 1938 and 1941, Hungary recovered part of her lost territories. During World War II Hungary came under German occupation in 1944, then under Soviet occupation until the end of the war. After World War II, the Second Hungarian Republic was established within Hungary's current-day borders as a socialist People's Republic, lasting from 1949–1989. In October 1989, the Third Republic of Hungary was established under an amended version of the constitution of 1949, with a new constitution adopted in 2011. Hungary joined the European Union in 2004.