First administrative reforms were enacted by councillors of the Siemens family. Nevertheless, the status of Imperial immediacy was finally lost, when Goslar was annexed by Prussian forces during the Napoleonic Wars in 1802, confirmed by the German Mediatisation the next year. Under Prussian rule, further reforms were pushed ahead by councillor Christian Wilhelm von Dohm. Temporarily part of the Kingdom of Westphalia upon the Prussian defeat at the 1806 Battle of Jena–Auerstedt, Goslar finally was assigned to the newly established Kingdom of Hanover by resolution of the Vienna Congress. The cathedral was sold and torn down from 1820 to 1822, bitterly mourned by Heinrich Heine in his travelogue. Again under Prussian rule after the Austro-Prussian War of 1866, Goslar became a popular retirement residence ("Pensionopolis") and a garrison town of the Prussian Army. The Hohenzollern kings and emperors had the Imperial Palace restored, including the mural paintings by Hermann Wislicenus.