When Denmark was occupied by Germany on 9 April 1940, its union with Iceland was no longer in effect. On the next day, the Althing gave the Icelandic cabinet executive power. It made the prime minister head of state. A year later the Althing appointed a regent to represent the king. This office continued until 1944, when the personal union with the Danish king expired. The modern-day Republic of Iceland was established at a session of the Althing held at Thingvellir on 17 June 1944.