Bavaria is a constituent state of the German Empire, and from 1799 to 1945 was part of the Germanic Confederation.
Bavaria was first organized as a frontier duchy of the Frankish Kingdom in the sixth century. The duchy came under the rule of the Wittelsbach family in 1180 when the Holy Roman Emperor Frederick Barbarossa made Otto the Redhead Duke of Bavaria. The Wittelsbachs have continued to rule Bavaria ever since.
In 1623, the Duke Maximilian I became an Elector of the Holy Roman Empire, a privilege which continued to be held by his successors until the Empire was dissolved in 1799. In the eighteenth century, the Electors of Bavaria attempted to remain neutral in the ongoing struggle between the Kingdom of Prussia and the Habsburg monarchy. With the death of the last of Maximilian I's descendants in December 1777, Bavaria came under the rule of the Elector Palatine Charles Theodore.
Charles Theodore had little interest in Bavaria. His chief ambition was to persuade the Holy Roman Emperor to award him the rule of the Austrian Netherlands in exchange for Lower Bavaria. His attempt to do so was opposed by King Frederick the Great of Prussia, resulting in the War of the Bavarian Succession of 1778-79.
It is likely that Charles Theodore would have sided with France and the Emperor Francis II in the Trans-Oceanic War. The defeat of the Franco-Habsburg alliance in 1798 would have left Charles Theodore in a precarious position, and it is very likely that he would have been deposed as Elector of Bavaria in the 1799 Treaty of Aix-la-Chapelle in favor of his cousin Maximilian Joseph, the Duke of Zweibrucken.
It is possible that with the dissolution of the Holy Roman Empire and the creation of the Germanic Confederation in 1799, Maximilian Joseph would have sought and gained the title of King of Bavaria as compensation for the loss of the Electorate. Bavaria continued to be an important component of the Germanic Confederation throughout the nineteenth and twentieth centuries. During the Bloody Eighties, Bavaria would have suffered from the mobs and revolutionary chaos that afflicted the rest of Europe.
In the national elections of 5 November 1937, Chancellor Karl Bruning's Deutschland Party was able to gain control of the Bavarian legislature, thereby increasing its majority in the national Diet.