The fortress saw repeated action during the wars of 1795-1815. In 1796, during the War of the First Coalition, the well-stocked fortress was handed over by its garrison to the French. In 1800/01, however, it was successfully defended against a new French attack by Imperial General Dall'Aglio during the War of the Second Coalition. In 1803, the fortress was occupied by troops of the Electorate of Bavaria after the Bishopric of Würzburg was secularized. From 1805-1814, Marienberg was a fortress of the Grand Duchy of Würzburg, part of the Confederation of the Rhine, the puppet state of the First French Empire. In 1813/14, French troops tenaciously defended the fortress against coalition forces. The French Emperor Napoleon himself visited the fortress in 1806, in 1812 before the Russian campaign and twice in 1813.