King of Bavaria was a title held by the hereditary Wittelsbach rulers of Bavaria in the state known as the Kingdom of Bavaria from 1805 until 1918, when the kingdom was abolished. It was the second time Bavaria was a kingdom, almost a thousand years after the short-lived Carolingian kingdom of Bavaria. History Under the terms of the Treaty of Pressburg concluded 26 December 1805 between Napoleonic France and Holy Roman Emperor Francis II, several principalities allied to Napoleon were elevated to kingdoms. One of the staunchest of these had been the prince-elector of Bavaria, Maximilian IV Joseph, and on 1 January 1806, he formally assumed the title King Maximilian I Joseph of Bavaria. He was a member of the Wittelsbach branch Palatinate-Birkenfeld-Zweibrücken. Maximilian's successors resisted German nationalism, and Bavaria became the protector of smaller states whose leaders felt threatened by Prussia or Austria in the German Confederation. Religious ties and the Upper German language linked the state more to Austria until their defeat in the Austro-Prussian War. King Ludwig II signed an alliance with Prussia on 22 August 1866, effectively relinquishing Bavarian independence. With the treaty of 23 November 1870 Bavaria was integrated into the new German Empire, but permitted a relatively large degree of self-determination. The Kings of Bavaria maintained their titles, and maintained separate diplomatic and military corps. When the German Empire was abolished in November 1918 after the end of World War I, the last king of Bavaria, Ludwig III, was deposed. Kings of Bavaria Maximilian I Joseph 1805–1825 Ludwig I 1825–1848 (d. 1868) Maximilian II 1848–1864 Ludwig II 1864–1886 Otto 1886–1913 (d. 1916) Prince Luitpold of Bavaria, Regent 1886–1912 Prince Ludwig of Bavaria, Regent 1912–1913 Ludwig III 1913–1918 The title King of Bavaria is sometimes used in reference to Carolingian kings ruling over Bavaria. See List of rulers of Bavaria for these. Royal Bavaria Current heir Franz Bonaventura Adalbert Maria Herzog von Bayern (born 14 July 1933), styled His Royal Highness The Duke of Bavaria, is head of the Wittelsbach family, the former ruling family of the Kingdom of Bavaria. The succession to the headship of the family is determined by Article 2 of Title 2 of the 1818 Constitution of the Kingdom of Bavaria, which states, "The crown is hereditary among the male descendants of the royal house according to the law of primogeniture and the agnatic lineal succession." The succession is further clarified