Malmö castle was first a fortress, built around 1430. Later, it took on the role of Denmark's Mint, then became a royal residence. When it returned to Swedish hands in 1658, the fortifications were reinforced and moats and bastions were built around the castle. From the 18C onwards, it lost its strategic importance and was used as a prison. In 1937, three rows of buildings were built around the courtyard to house the collections of the city's museums.