The Treaty of Ried (8 October 1813) saw the Kingdom of Bavaria abandon its long-standing support for France and join the Sixth Coalition. This came just before the battle of Leipzig (16-19 October 1813) and thus can't be said to have had much impact on the course of the War of Liberation, although the Bavarians did make an unsuccessful attempt to intercept Napoleon's retreating army after Leipzig.
At the start of the War of the First Coalition Bavaria had been an electorate within the Holy Roman Empire, and had fought against the French during the war. Maximilian IV Joseph, who became Elector in 1799, favoured the French, but still had to fight against them during the War of the Second Coalition. However, when the Austrians were forced to make peace (Treaty of Luneville), Maximilian took his chance to switch sides. He signed a separate peace with France in August 1801, in which he surrendered his territories west of the Rhine, in return for a promise of lands in southern Germany. Napoleon kept this promise, and in 1803 Bavaria gained Würzburg, Bamberg, Freising, Augsburg, Passau and fifteen other cities, becoming a sizable contiguous state. Bavaria fought on the French side during the War of the Third Coalition, and in the peace that followed gained the Tyrol, Vorarlberg and Ansbach.
On 1 January 1806 Maximilian became King Maximilian I of Bavaria. On 14 January his daughter Auguste-Amelie married Napoleon's step-son Eugène de Beauharnais. Any chance of Bavaria becoming a truly independent kingdom was ended in July when Napoleon insisted that Bavaria join the Confederation of the Rhine, provide 30,000 troops for the Confederation Army, and accept France as the protector of southern Germany.
For the next few years Maximilian served as a loyal French ally. Bavarian troops fought in the War of the Third Coalition, taking part in the Austerlitz campaign. During the War of the Fourth Coalition they fought against the Prussians, and during the War of the Fifth Coalition against the Austrians.
In 1812 the Bavarians provided a contingent for the disastrous invasion of Russia. In 1813 they formed part of Napoleon's army during the War of Liberation in Germany. The Bavarians served loyally during the Spring Campaign, and at the start of the Autumn Campaign were given the task of watching the Austrians on the River Inn, their border on the Danube.
By now Maximilian's enthusiasm for the French alliance had faded, and on 8 October 1813 the Bavarians signed the Treaty of Ried. They joined the Sixth Coalition, and in an unusual step their commander on the Inn, General Wrede, was given command of a combined Bavarian-Austrian army, made up of the forces that had been opposing each other.
Wrede led this army north-west towards Frankfurt, where on 30-31 October he attempted to intercept what he believed was a small part of the retreating French army (Battle of Hanau). Instead he was attacked by Napoleon in person, and suffered an embarrassing defeat.
King Maximilian didn’t gain much from his change of sides. He was allowed to keep his title of King, but he lost most of the lands he had gained as a French ally. He was also forced to join the new German Confederation, so once again failed in his efforts to turn Bavaria into an independent kingdom.