(headed by Maximilian Joseph) and Palatinate-Birkenfeld (headed by Count Palatine William). Maximilian Joseph inherited Charles Thedore's title of Elector of Bavaria, while William was compensated with the title of Duke in Bavaria. The form Duke in Bavaria was selected because in 1506 primogeniture had been established in the House of Wittelsbach resulting in there being only one Reigning Duke of Bavaria at any given time. Maximillian Joseph assumed the title of king as Maximilian I Joseph on 1 January 1806. The new king still served as a Prince-elector until the Kingdom of Bavaria left the Holy Roman Empire (1 August 1806). Kingdom of Bavaria, 1806–1918 Under Maximilian's descendants, Bavaria became the third most powerful German state, behind only Prussia and Austria. It was also far-and-away the most powerful secondary state. When the German Empire was formed in 1871, Bavaria became the new empire's second most powerful state after Prussia. The Wittelsbachs reigned as kings of Bavaria until 1918. On 12 November 1918 Ludwig III issued the Anif declaration (German: Anifer Erklärung) at Anif Palace, Austria, in which he released his soldiers and officials from their oath of loyalty to him and ended the 738-year rule of the House of Wittelsbach in Bavaria. The republican movement thereupon declared a republic. Activities during the Nazi regime, 1933–1945 Before and during the Second World War, the Wittelsbachs were anti-Nazi. Crown Prince Rupert earned Hitler's eternal enmity by opposing the Beer Hall Putsch in 1923. The family initially left Germany for Hungary, but were eventually arrested. Family members spent time in several Nazi concentration camps including Oranienburg and Dachau. Reign outside the Holy Roman Empire With Duke Otto III of Lower Bavaria, who was a maternal grandson of Béla IV of Hungary and was elected anti-king of Hungary and Croatia as Bela V (1305–1308) the Wittelsbach dynasty came to power outside the Holy Roman Empire for the first time. Otto had abdicated the Hungarian throne by 1308. Palatinate branch Christopher III of the House of Palatinate-Neumarkt was king of Denmark, Sweden and Norway in 1440/1442–1448, but he left no descendants. The House of Palatinate-Zweibrücken contributed to the monarchy of Sweden again 1654–1720 under Charles X, Charles XI, Charles XII and Ulrika Eleonora. Sophia from the House of Palatinate-Simmern was a presumptive Queen of Great Britain, with her eldest son succeeding the throne. United Kingdom Today, under the Bill of Rights 1689 and the Act