the Treaty of Zboriv. When hostilities resumed, however, his forces suffered a massive defeat in 1651 at the Battle of Berestechko, the largest land battle of the 17th century, and they were abandoned by their former allies, the Crimean Tatars. They were forced at Bila Tserkva to accept the Treaty of Bila Tserkva. A year later, in 1652, the Cossacks had their revenge at the Battle of Batih, where Khmelnytsky ordered Cossacks to kill all Polish prisoners and paid Tatars for possession of the prisoners, an event known to as the Batih massacre. However, the enormous casualties suffered by the Cossacks at Berestechko made the idea of creating an independent state impossible to implement. Khmelnytsky had to decide whether to stay under Polish–Lithuanian influence or ally with the Muscovites. Tatars' role The Tatars of the Crimean Khanate, then a vassal state of the Ottoman Empire, participated in the insurrection, seeing it as a source of captives to be sold. Slave raiding sent a large influx of captives to slave markets in Crimea at the time of the Uprising. Ottoman Jews collected funds to mount a concerted ransom effort to gain the freedom of their people. Aftermath Within a few months almost all Polish nobles, officials and priests had been wiped out or driven from the lands of present-day Ukraine. The Commonwealth population losses in the uprising exceeded one million. In addition, Jews suffered substantial losses because they were the most numerous and accessible representatives of the szlachta regime. The uprising began a period in Polish history known as The Deluge (which included the Swedish invasion of the Commonwealth during the Second Northern War of 1655–1660), that temporarily freed the Ukrainians from Polish domination but in a short time subjected them to Russian domination. Weakened by wars, in 1654 Khmelnytsky persuaded the Cossacks to ally with the Russian tsar in the Treaty of Pereyaslav, which led to the Russo-Polish War (1654–1667). When Poland–Lithuania and Russia signed the Truce of Vilna and agreed on an anti-Swedish alliance in 1657, Khmelnytsky's Cossacks supported the invasion of the Commonwealth by Sweden's Transylvanian allies instead. Although the Commonwealth tried to regain its influence over the Cossacks (note the Treaty of Hadiach of 1658), the new Cossack subjects became even more dominated by Russia. With the Commonwealth becoming increasingly weak, Cossacks became more and more integrated into the Russian Empire, with their autonomy and privileges eroded.