From the 17th century, the nobles' democracy, experienced devastating wars and fell into internal disorder and then anarchy, and as a result declined. The once powerful Commonwealth had become vulnerable to internal warfare and foreign intervention. In 1648 the Cossack Khmelnytsky Uprising engulfed the south and east of the vast Polish–Lithuanian state, and was soon followed by a Swedish invasion, which raged through core Polish lands. Warfare with the Cossacks and Russia left Ukraine divided; the eastern part, lost by the Commonwealth, became a dependency of the Tsardom of Russia. John III Sobieski, who fought protracted wars against the Ottoman Empire, revived the Commonwealth's military might once more. In one decisive engagement he helped in 1683 to deliver Vienna from a Turkish onslaught.