After the Nazis took power in Germany in the 1930s, new military barracks were built, and the invasion of Poland was carried out from the town at the beginning of World War II in 1939. During the war, three forced labour camps were established and operated by the Germans in the town, and its prisoners were mostly Poles and Russians. In September 1944, the Germans made the first arrests of local members of the Polish underground organization "Odra", ultimately crushing it in the following weeks. In February 1945, the town was captured by the Red Army, and the local agricultural machinery factory, which used forced labour during the war, was plundered by occupying Russian forces. The town then passed to Poland, although with a Soviet-installed communist regime, which remained in power until the Fall of Communism in the 1980s. The town's German population was expelled in accordance with the Potsdam Agreement, and it was repopulated with Poles, expellees from former eastern Poland annexed by the Soviet Union and settlers from central Poland. The plundered agricultural machinery factory was relaunched by Poles in July 1945. The Polish anti-communist resistance ("cursed soldiers") was active in the town, and many of its members were arrested and sentenced to prison by the communists. The last "cursed soldier" of Szczecinek, Maria Sosnowska, died in 2018.