During the Italian campaigns of the French Revolutionary Wars, Lienz was occupied twice by French troops in 1797. After the Austrian defeat at the Battle of Austerlitz, Lienz with Tyrol passed to the Electorate of Bavaria according to the 1805 Peace of Pressburg. In 1809 it became the administrative centre of a district within the short-lived Napoleonic Illyrian Provinces, but was reconquered by Austrian troops in 1813. Until 1918, the town was again part of the Austrian monarchy (Austria side after the compromise of 1867), head of the district of the same name, one of the 21 "Bezirkshauptmannschaften" in the Tyrol province.