During 1629, near the end of the Polish-Swedish War of 1626–29, the town was conquered by Swedish troops led by king Gustav II Adolph of Sweden personally. During the events of war, the town suffered demolitions. The town was conquered a second and third time by Sweden in 1656 and 1657 during the Second Northern War. On the latter occasion, the castle was destroyed completely and has since then remained a ruin. After the war only 94 houses were inhabited, 103 stood empty and 35 were burned down. Also the suburbs had been damaged considerably.