army along French lines, and it soon became the most modern in Germany, and the first in Germany to abolish flogging. The field army was based largely on compulsory military service. A national guard with three classes was also developed (1st class: Reserve battalions of the Line regiments; 2nd class: Territorial army; 3rd class: Citizen levy). In 1800, Bavaria reluctantly fought on Austria's side against France, but in 1805 when Austria attacked Bavaria for the third time in 100 years, they found a powerful army. The Bavarians initially retreated, but only in order to link up with Napoleon's advancing army and to prepare the counter-attack, which took place quickly, methodically and thoroughly. 30,000 Bavarian troops took part in the successful Siege of Ulm and the consequent liberation of Bavaria. At the Battle of Austerlitz, the Bavarians secured the flanks and supply lines of Napoleon's army and in 1806-7 they forced several Prussian forts to surrender. Bavaria was awarded the Austrian province of Tyrol as a reward, but unrest erupted into a full-blown rebellion under Andreas Hofer in 1809, which could only be put down with French assistance. When Austria attacked Bavaria once more in 1809, Napoleon's army was concentrated in Spain, and it was troops of the Confederation of the Rhine, predominantly Bavarian, which led the early campaigning against Austria. At the Battle of Wagram, the contribution of Bavarian forces was decisive to the outcome. In the Russian Campaign, the Bavarian army suffered terrible losses - of about 33,000 men (including following reinforcements) who marched in 1812, only 4,000 returned. Pressed by the Crown Prince and General Wrede, King Maximilan I Josef turned with a heavy heart away from the French and changed to the Allied camp shortly before the Battle of Leipzig. The attempt by Wrede to stop the victory of the Grande Armée in 1813 at the Battle of Hanau ended in a narrow defeat for his Austro-Bavarian corps. The campaign of 1814 began badly for the Allies, but Wrede made up for his earlier defeat with valuable victories over his former allies at the battles of Arcis-sur-Aube and Bar-sur-Aube. In 1814, the Bavarian Army consisted of a Grenadier Guard regiment, 16 regiments of Line Infantry, two battalions of Jäger, seven regiments of light cavalry (of which one was territorial), one regiment of Uhlans, two Hussar regiments, one regiment of Garde du Corps (mounted royal bodyguard), two regiments