Starting in the mid-17th century, the city began to decline due to the stationing of foreign troops, alterations in trade routes, and numerous natural disasters. Further devastation was caused by the Deluge, a series of disastrous wars with Sweden that left the Polish–Lithuanian Commonwealth in ruins. The invading Swedes razed houses, farms, peasant buildings, hospitals, and three wooden churches on the outskirts of the city.