the hands of Austria; on 2 December 1800, the Bavarian arms were involved in the Austrian defeat at Hohenlinden, and Moreau once more occupied Munich. By the Treaty of Lunéville (9 February 1801), Bavaria lost the Palatinate and the duchies of Zweibrücken and Jülich. In view of the scarcely disguised ambitions and intrigues of the Austrian court, Montgelas now believed that the interests of Bavaria lay in a frank alliance with the French Republic; he succeeded in overcoming the reluctance of Maximilian Joseph; and, on 24 August, a separate treaty of peace and alliance with France was signed at Paris. The 1805 Peace of Pressburg allowed Maximilian to raise Bavaria to the status of a kingdom. Accordingly, Maximilian proclaimed himself king on 1 January 1806. The King still served as an elector until Bavaria seceded from the Holy Roman Empire on 1 August 1806. The Duchy of Berg was ceded to Napoleon only in 1806. The new kingdom faced challenges from the outset of its creation, relying on the support of Napoleonic France. The kingdom faced war with Austria in 1808 and from 1810 to 1814, lost territory to Württemberg, Italy, and then Austria. In 1808, all relics of serfdom were abolished, which had left the old empire. In the same year, Maximilian promulgated Bavaria's first written constitution. Over the next five years, it was amended numerous times in accordance with Paris' wishes. During the French invasion of Russia in 1812 about 30,000 Bavarian soldiers were killed in action. With the Treaty of Ried of 8 October 1813 Bavaria left the Confederation of the Rhine and agreed to join the Sixth Coalition against Napoleon in exchange for a guarantee of her continued sovereign and independent status. On 14 October, Bavaria made a formal declaration of war against Napoleonic France. The treaty was passionately backed by the Crown Prince Ludwig and by Marshal von Wrede. With the Battle of Leipzig in October 1813 ended the German Campaign with the Coalition nations as the victors, in a complete failure for the French, although they achieved a minor victory when an army of Kingdom of Bavaria attempted to block the retreat of the French Grande Armée at Hanau. With the defeat of Napoleon's France in 1814, Bavaria was compensated for some of its losses, and received new territories such as the Grand Duchy of Würzburg, the Archbishopric of Mainz (Aschaffenburg) and parts of