Magdeburg was founded by Charlemagne in 805 and became the seat of an Archbishopric in 968. In the 13th century it joinmed the Hanseatic League, and in 1524 Martin Luther brought the Reformation to the city. During the Thirty Years War it was besieged in 1629, and in 1631 was sacked by Imperial troops, with an estimated 20,000 inhabitants being massacred. According to an ordinance of the Peace of Westphalia of 1648, the city became part of Brandenburg (Prussia) in 1680.
Magdeburg was very heavily damaged by aerial bombing during the Second World War and although initially occupied by American forces during the defeat of Germany, it subsequently lay in the Soviet zone of occupation (from 1949 the German Democratic Republic, or East Germany). The headquarters of the occupying Soviet forces were located in Magdeburg.