Polish–Cossack–Tatar War (1666–1671)

The Polish–Cossack–Tatar War (Ukrainian: Польсько-козацько-татарська війна, Polish: Wojna polsko-kozacko-tatarska) was fought between the Polish–Lithuanian Commonwealth and the Ottoman-allied states of the Cossack Hetmanate and the Crimean Khanate.

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

Trying to capitalize on that weakness, Crimean Tatars, who commonly raided across the Polish–Lithuanian Commonwealth borders in search of loot and slaves, invaded, this time allying themselves with Zaporozhian Cossacks under the command of Hetman Petro Doroshenko.

They were however stopped by the Polish–Lithuanian Commonwealth's forces under the command of Hetman John III Sobieski, who stopped their first push (1666–1667), defeating them several times, and finally gaining an armistice after the Battle of Pidhaitsi in 6–16 October 1667.

Khan Selim I Giray then renewed his oath of allegiance to the Ottoman Sultan Mehmed IV and pleaded for assistance, to which the Ottoman Sultan Mehmed IV agreed.