The history of the Polish–Lithuanian Commonwealth (1648–1764) covers a period in the history of Poland and the Grand Duchy of Lithuania, from the time their joint state became the theater of wars and invasions fought on a great scale in the middle of the 17th century, to the time just before the election of Stanisław August Poniatowski, the last king of the Polish–Lithuanian Commonwealth. 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. Further disintegration followed nevertheless. The Commonwealth, subjected to almost constant warfare until 1720, suffered devastating population losses and massive damage to its economy and social structure. The economic regression had not been fully compensated for the duration of the Commonwealth's existence. The government became ineffective because of large scale internal conflicts (e.g. Lubomirski's Rokosz against John II Casimir and rebellious confederations), corrupted legislative processes (such as the infamous use of the liberum veto) and manipulation by foreign interests. The nobility class fell under the control of a handful of powerful families with established territorial domains, the urban population and infrastructure fell into ruin, together with most peasant farms. The reigns of two kings of the Saxon Wettin dynasty, Augustus II the Strong and Augustus III, brought the Commonwealth more political damage and little meaningful reform. The Great Northern War, a period seen by the contemporaries as a passing eclipse, may have been the decisive blow that critically weakened the Polish-Lithuanian state. The Kingdom of Prussia became a strong regional power and took Silesia from the Habsburg monarchy. The Commonwealth-Saxony personal union, however, gave rise to the emergence of the reform movement in the Commonwealth, and the beginnings of the Polish Enlightenment culture. Economic and social decline War destruction, economic breakdown, social disintegration The