During the Polish-Swedish War, in 1657 the town was captured by Poles. From the 18th century it was part of the Kingdom of Prussia and subsequently in 1871 it became part of Germany. After the defeat of Nazi Germany in 1945, it became part of Poland.