With secularization of the government in 1803, the territory of the present municipality became part of Bavaria. In the Treaty of Pressburg between France and Austria in 1805, the lands of the Bishop of Würzburg were given to Ferdinand III, Grand Duke of Tuscany, and he was made Grand Duke of Würzburg, a new state, as a reward for his support of Napoleon. These lands then again became part of Bavaria in 1814 (this time permanently) at the defeat of Napoleon.