In the 17th century, during the Swedish Deluge, Polish troops led by Stefan Czarniecki fought together with soldiers from Denmark–Norway against the Swedish invasion in Poland and during the Dano-Swedish War. By the late 18th century, the third and final partition of Poland had occurred and Poland lost its independence for the next 123 years.