During World War II, the Germans established the 5/111 forced labour camp in the town. The victims of the camp are commemorated by a monument at the local cemetery. On January 23, 1945, the 10th Guards Tank Corps of the 4th Guards Tank Army commanded by General Dmitry Lelyushenko defeated the German garrison of Trachenberg and captured the town. The town was destroyed, except for the castle, which was set afire after the battle. After Germany's defeat in the war, the town under the restored Polish name Żmigród came under Polish administration. End of June 1945, the German population was ordered to leave their home for Germany west of the Oder-Neisse line, in accordance to the Potsdam Agreement. About 20 of the men were interned. Żmigród was repopulated by Poles, many of whom were expelled from former eastern Poland annexed by the Soviet Union. The first transport of Poles from those territories arrived in June 1945 from Vilnius.