 During the First Partition of Poland in 1772, the town became part of the Kingdom of Prussia.It briefly belonged to the Duchy of Warsaw, but again became part of Prussia following the Congress of Vienna in 1815.After the First World War, the town became part of the Second Polish Republic in 1919 following the Greater Poland Uprising.