Polish–Cossack–Tatar War (1666–71)

Polish-Cossack-Tatar War was the war between the Polish-Lithuanian Commonwealth and the Ottoman Empire (in practice, the Cossack Hetmanate and Crimean Khanate) over Ukraine. It was one of the aftermaths of the Russo-Polish War (1654–67) and a prelude to the Polish–Ottoman War (1672–76).

Hostilities
In 1666 Petro Doroshenko, Hetman of Right-bank Ukraine, aiming to gain control of Ukraine but facing defeats from other factions struggling over control of that region (the Commonwealth and the Tsardom of Russia), in a final bid to preserve his power in Ukraine, signed a treaty with Sultan Mehmed IV that recognized the Cossack Hetmanate as a vassal of the Ottoman Empire.

In the meantime, Commonwealth forces were trying to put down unrest in Ukraine, but were weakened by decades long wars (Khmelnytsky Uprising, The Deluge and Russo-Polish War (1654–67)). Trying to capitalize on that weakness, Tatars, who commonly raided across the Commonwealth borders in search of loot and plunder, invaded, this time allying themselves with Cossacks under hetman Doroshenko. They were however stopped by Commonwealth forces under hetman Jan Sobieski, who stopped their first push (1666–67), defeating them several times, and finally gaining an armistice after the battle of Podhajce.

In 1670, however, hetman Doroshenko tried once again to take over Ukraine, and in 1671 Khan of Crimea, Adil Giray, supportive of the Commonwealth, was replaced with a new one, Selim I Giray, by the Ottoman sultan. Selim entered into an alliance with the Doroshenko's Cossacks; but again like in 1666–67 the Cossack-Tatar forces were dealt defeats by Sobieski. Selim then renewed his oath of allegiance to the Ottoman Sultan and pleaded for assistance, to which the Sultan agreed. Thus an irregular border conflict escalated into a regular war, as the Ottoman Empire was now prepared to send its regular units onto the battlefield in a bid to try to gain control of that region for itself.