During the Napoleonic War and the Danish-German Wars the castle served as a military hospital, and from 1864 to 1919 it was a Prussian barracks. After a referendum in 1920 the northern part of South Jutland, and with it Sønderborg Castle, became Danish.
In 1908 the castle was converted into a museum with emphasis on the more recent history of South Jutland. A major restoration from 1964 to 1973 removed most of the traces from the time of the Prussian infantry.
Sønderborg Castle was built about 1170 on the island of Als, and during the 14th and 15th centuries it became a heavily fortified citadel owned alternately by the Danish kings and the dukes of South Jutland.
From 1532 to 1549 the castle served as a prison for the deposed King Christian II. From 1549 it was renovated by King Christian III and Queen Dorothea, and their chapel is the best preserved Lutheran chapel from the time of the Reformation in Europe.
An extensive rebuilding in the Baroque Style was carried out from 1718 to 1726, and in the middle of the century the bastions were almost completely removed.