A Saxon–Prussian alliance fought the War of the Bavarian Succession (July 1778 – 21 May 1779) against the Austrian Habsburg Monarchy to prevent the Habsburgs from acquiring the Electorate of Bavaria. Although the war consisted of only a few minor skirmishes, thousands of soldiers died from disease and starvation, earning the conflict the name Kartoffelkrieg (Potato War) in Prussia and Saxony; in Habsburg Austria, it was sometimes called the Zwetschgenrummel (Plum Fuss).
On 30 December 1777, Maximilian Joseph, the last of the junior line of Wittelsbach, died of smallpox, leaving no children. Charles IV Theodore, a scion of a senior branch of the House of Wittelsbach, held the closest claim of kinship, but he also had no legitimate children to succeed him. His cousin, Charles II August, Duke of Zweibrücken, therefore had a legitimate legal claim as Charles Theodore's heir presumptive. Across Bavaria's southern border, Holy Roman Emperor Joseph II coveted the Bavarian territory and had married Maximilian Joseph's sister Maria Josepha in 1765 to strengthen any claim he could extend. His agreement with the heir, Charles Theodore, to partition the territory neglected any claims of the heir presumptive, Charles August.
Acquiring territory in the German-speaking states was an essential part of Joseph's policy to expand his family's influence in Central Europe. For Frederick the Great, Joseph's claim threatened the Prussian ascendancy in German politics, but he questioned whether he should preserve the status quo through war or through diplomacy. Empress Maria Theresa, who co-ruled with Joseph, considered any conflict over the Bavarian electorate not worth bloodshed, and neither Maria Theresa nor Frederick saw any point in pursuing hostilities. Joseph would not drop his claim despite his mother's contrary insistence. Frederick August III, Elector of Saxony, wanted to preserve the territorial integrity of the Duchy for his brother-in-law, Charles August, and had no interest in seeing the Habsburgs acquire additional territory on his southern and western borders. Despite his dislike of Prussia, which had been Saxony's enemy in two previous wars, Charles August sought the support of Frederick, who was happy to challenge the Habsburgs. France became involved to maintain the balance of power. Finally, Catherine the Great's threat to intervene on the side of Prussia with fifty thousand Russian troops forced Joseph to reconsider his position. With Catherine's assistance, he and Frederick negotiated a solution to the problem of the Bavarian succession with the Treaty of Teschen, signed on 13 May 1779.
For some historians, the War of the Bavarian Succession was the last of the old-style Cabinet Wars (Kabinettskriege) of the Ancien Régime in which troops maneuvered while diplomats traveled between capitals to resolve their monarchs' complaints. The subsequent French Revolutionary Wars and Napoleonic Wars differed in scope, strategy, organization and tactics.