In the mid-17th century, a Cossack military quasi-state, the Zaporozhian Host, was formed by Dnieper Cossacks and by Ruthenian peasants who had fled Polish serfdom. Poland exercised little real control over this population, but found the Cossacks to be a useful opposing force to the Turks and Tatars, and at times the two were allies in military campaigns. However the continued harsh enserfment of peasantry by Polish nobility and especially the suppression of the Orthodox Church alienated the Cossacks.
Ukraine
The Cossacks sought representation in the Polish Sejm, recognition of Orthodox traditions, and the gradual expansion of the Cossack Registry. These were rejected by the Polish nobility, who dominated the Sejm.
Cossack Hetmanate:
Khmelnytsky, deserted by his Tatar allies, suffered a crushing deafeat at the Battle of Berestechko in 1651, and turned to the Russian tsar for help. In 1654, Khmelnytsky was subject to the Pereyaslav Council, forming a military and political alliance with Russia that acknowledged loyalty to the Russian tsar.
In 1657–1686 came “The Ruin“, a devastating 30-year war amongst Russia, Poland, the Crimean Khanate, the Ottoman Empire, and Cossacks for control of Ukraine, which occurred at about the same time as the Deluge of Poland. The wars escalated in intensity with hundreds of thousands of deaths. The “Treaty of Perpetual Peace” between Russia and Poland in 1686 divided the lands of the Cossack Hetmanate between them, reducing the portion over which Poland had claimed sovereignty.
In 1709, Cossack Hetman Ivan Mazepa (1639–1709) defected to Sweden against Russia in the Great Northern War (1700–1721). Eventually Tsar Peter recognized that to consolidate and modernize Russia’s political and economic power it was necessary to do away with the Cossack Hetmanate and Ukrainian and Cossack aspirations to autonomy. Mazepa died in exile after fleeing from the Battle of Poltava (1709), in which the Swedes and their Cossack allies suffered a catastrophic defeat.
The hetmanate was abolished in 1764; the Zaporozhian Sich was abolished in 1775, as Russia centralized control over its lands. As part of the Partitions of Poland in 1772, 1793 and 1795, the Ukrainian lands west of the Dnieper were divided between Russia and Austria. From 1737 to 1834, expansion into the northern Black Sea littoral and the eastern Danube valley was a cornerstone of Russian foreign policy.
Cossacks led an uprising, called Koliivshchyna, starting in the Ukrainian borderlands of the Polish–Lithuanian Commonwealth in 1768. Ethnicity was one root cause of this revolt, which included the Massacre of Uman that killed tens of thousands of Poles and Jews. Religious warfare also broke out among Ukrainian groups. Increasing conflict between Uniate and Orthodox parishes along the newly reinforced Polish-Russian border on the Dnieper in the time of Catherine the Great set the stage for the uprising. As Uniate religious practices had become more Latinized, Orthodoxy in this region drew even closer into dependence on the Russian Orthodox Church. Confessional tensions also reflected opposing Polish and Russian political allegiances.