the Teutonic Order In 1568, Georg Hund von Wenkheim, Grand Master since 1566, began to expand Mergentheim Castle into a palatial residence. Maximilian III, Archduke of Austria, as Grand Master of the Teutonic Order, established a seminary on the grounds of Mergentheim Palace in 1606–07. It was to be staffed by 12 knights gathered from the Teutonic bailiwicks. In 1694, Francis Louis of Palatinate-Neuburg, the Prince-Bishop of Breslau, was elected Grand Master of the Teutonic Order to replace his late brother Louis Anton. Francis Louis, who go on to hold five high ecclesiastical offices and extensively reform the Order, rarely spent time at Mergentheim. Towards the end of his tenure, however, he wrote to the Mergentheim authorities about constructing a new high altar in the palace church. When he was informed that it had fallen into disrepair, he ordered a new church. Construction began in 1730, but Francis Louis died in 1732. He was succeeded as Grand Master by Clemens August of Bavaria, who finished the church in 1736. Secularization According to the 1797 Peace of Campo Formio, which concluded the War of the First Coalition, France was to annex the Left Bank of the Rhine and the German princes who lost territory to France were to be compensated with ecclesiastical possessions east of the Rhine. This compensation ballooned into the Reichsdeputationshauptschluss of 1802–03, which erased all ecclesiastical states except the Electorate of Mainz, which was moved south to Regensburg, and the Teutonic Knights at Mergentheim, and the Knights Hospitaller at Heitersheim. The ecclesiastical states were to be governed by German nobles, with the Teutonic Knights coming under Austrian control. Just two years later in 1805, at the end of the War of the Third Coalition, the Peace of Pressburg gave Mergentheim fully to Austria. Austrian troops were stationed in the town until 1809, when it was occupied by the Kingdom of Württemberg on 20 April 1809, during the War of the Fifth Coalition. In the process of German mediatization that followed in 1809, Napoleon Bonaparte stripped the Teutonic order of its possessions in what was to become the Confederation of the Rhine. Mergentheim was awarded to Württemberg on 29 May 1809 In the process of annexation, Württemberger authorities looted Mergentheim Palace and moved the seminary's library to Stuttgart, the kingdom's capital. In 1827, Duke Paul Wilhelm of Württemberg received Mergentheim Palace as his residence following his marriage to Princess