The Thirty Years' War (1618–48) was especially devastating. the Elector changed sides three times, and as a result Protestant and Catholic armies swept the land back and forth, killing, burning, seizing men and taking the food supplies. Upwards of half the population was killed or dislocated. Berlin and the other major cities were in ruins, and recovery took decades. By the Peace of Westphalia, Brandenburg gained Minden and Halberstadt, also Pomerania and the Duchy of Magdeburg .