Prosperity was halted in the 1620s, when the town suffered a fire and an epidemic. In 1626, during the Swedish invasion, canons from Frombork (Frauenburg) took refuge in the town, which the Swedes did not reach. The city was sacked by Swedish troops later, in 1655 and 1708, during the next Polish-Swedish wars, and its population was nearly wiped out in 1710 by epidemics of bubonic plague and cholera.