The causes of the Polish-Ottoman War of 1672-76 can be traced to 1666. Petro Doroshenko Hetman of Zaporizhian Host, aiming to gain control of Ukraine but facing defeats from other factions struggling over control of that region, in a final bid to preserve his power in Ukraine, signed a treaty with Sultan Mehmed IV in 1669 that recognized the Cossack Hetmanate as a vassal of the Ottoman Empire.:273 In the meantime, Commonwealth forces were trying to put down unrest in Ukraine, but were weakened by decades long wars ). 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 John Sobieski, who stopped their first push , 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 in 1671, 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.:646
Question: Who stopped the Tatars?
Answer: Commonwealth forces