In 1654 Minsk was conquered by troops of Tsar Alexei of Russia. Russians governed the city until 1667, when it was regained by the King of Poland and Grand Duke of Lithuania John II Casimir Vasa. By the end of the Deluge, Minsk had only about 2,000 residents and just 300 houses. Other cities and towns of Lithuania were also heavily devastated by the war. The second wave of devastation occurred during the Great Northern War when Minsk was occupied in 1708 and 1709 – by the Swedish army of Charles XII and then by the Russian army of Peter the Great. Minsk paid large retributions to both foreign armies.