In the next few years, the Habsburg army under Charles reconquered Hungary, Slavonia and Transylvania; his first siege of Buda in 1684 ended in defeat but was followed by major victories over the Ottomans at the siege of Buda in 1686 and the second battle of Mohács in 1687. In May 1688, he resigned his military commission in favor of Maximilian II Emanuel, Elector of Bavaria. When the War of the Palatine Succession broke out in September 1688, he returned to command Imperial forces in the Rhineland and reconquered Mainz from the French on 8 September 1689 but fell ill. He initially returned to his family in Innsbruck, but then wanted to travel to Vienna to organize a comprehensive army reform with Emperor Leopold. He died of a pulmonary embolism in Wels on 8 April 1690. He was succeeded by his son Leopold, who was restored as Duke of Lorraine after the 1697 Treaty of Ryswick. He was initially buried in the Jesuit Church in Innsbruck but after the treaty of Ryswick his remains were transferred to the ducal chapel in Church of Saint-François-des-Cordeliers in Nancy, Lorraine.