withdrawal the Weimaran troops reoccupied the castle and the town. In autumn 1640, after a 14-day siege, Spanish troops once more took their place. In September 1644, the castle and the town were taken by French soldiers after a 10-day siege; the following month, Cologne troops attacked them and forced them to retreat to the castle with heavy losses. The Cologne commander, Constantin von Nievenheimb, therefore ordered the bombardment and "more or less ruination" of the castle, but did not attempt to capture it. The French soldiers remained until 24 July 1650 but had to vacate the castle under the terms of the Peace of Westphalia, which returned it to the Palatinate and Count Palatine Karl Ludwig. In 1666, he had the castle repaired and made some alterations: he greatly changed the interior of the palas and between it and the northern rampart built a massive new building with a Fachwerk half-timbered upper storey. An inscribed stone tablet on the palas commemorates his rebuilding of the castle. During the War of the Palatine Succession, the castle was decisively destroyed, like most of the fortifications in the Upper Middle Rhine Valley. Its commander, von Dachenhausen, surrendered it to French troops on 11 October 1688, but on 15 March 1689 they blew it up. The explosion completely destroyed both the ring wall and the keep, the residential buildings burned out in the resulting fire, and debris from the explosion destroyed the Gothic Werner Chapel at the foot of the castle hill. The castle was so heavily damaged that it was not rebuilt. Under the 1697 Treaty of Ryswick, the ruin reverted to the Palatinate, where it remained until the dissolution of the County at the end of the 18th century. French and Prussian ownership After the occupation of the parts of the Palatinate on the left bank of the Rhine by French Revolutionary troops in 1794, in 1801 the Treaty of Lunéville awarded the ruined castle to the French; in 1804 they offered it for sale. In 1815 the Congress of Vienna resulted in its passing into the possession of the Kingdom of Prussia. In 1828 the then Crown Prince Frederick William acquired it in order to give it to his wife Elisabeth Ludovika of Bavaria; she was a Wittelsbach princess. In association with a visit by her in the 1850s, large parts of the toppling walls were cleared, and the rubble