Between 1871 and 1945 the area was part of Germany (province of East Prussia). In the late 19th century the town was slowly declining. Local Jews, whose community existed since the beginning of the 19th century, were imprisoned by the Germans in the Stutthof concentration camp during World War II. Also, the Germans operated a forced labour subcamp of the Stalag I-A prisoner-of-war camp in the town, and a subcamp of the Stutthof concentration camp near the town. The inmates of the latter were evacuated in January 1945 and murdered in the Palmnicken massacre. In early February 1945, the Soviets entered the almost completely abandoned city, plundered it and destroyed it. After the war it became again part of Poland.