War of the Bavarian Succession: Russian and French mediators at the Congress of Teschen negotiate an end to the war. In the agreement Austria receives the part of its territory that was taken from it (the Innviertel).

The Treaty of Teschen (German: Frieden von Teschen, i.e., "Peace of Teschen"; French: Trait de Teschen) was signed on 13 May 1779 in Teschen, Austrian Silesia, between the Austrian Habsburg monarchy and the Kingdom of Prussia, which officially ended the War of the Bavarian Succession.

The War of the Bavarian Succession (German: Bayerischer Erbfolgekrieg; 3 July 1778 – 13 May 1779) was a dispute between the Austrian Habsburg Monarchy and an alliance of Saxony and Prussia over succession to the Electorate of Bavaria after the extinction of the Bavarian branch of the House of Wittelsbach. The Habsburgs sought to acquire Bavaria, and the alliance opposed them, favoring another branch of the Wittelsbachs. Both sides mobilized large armies, but the only fighting in the war was a few minor skirmishes. However, 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, diplomacy, or trade. Empress Maria Theresa, who co-ruled with Joseph, considered any conflict over the Bavarian electorate not worth bloodshed, and neither she 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 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.