In 1797 the castle was declared to be French government property. In 1816 after the Congress of Vienna the ruin became the property of the Kingdom of Bavaria together with the complete "linksrheinische Pfalz" (literally translated: left-Rhine Palatinate). A short time later citizens of Neustadt gave the worthless estate to the Bavarian King Maximilian II as a "wedding present". Because of this, the castle is also called "Maxburg" in colloquial language. In 1844 Bavaria began to rebuild the castle in neo-gothic style, August von Voit had provided the plans.