The Turkish Sultan appointed Yuri Khmelnitsky Hetman of the Right-bank Ukraine, who had been the Sultan's prisoner at that time. In July 1677, the Sultan ordered his army  under the command of Ibrahim Pasha to advance towards Chyhyryn. July 30 1677 at the fortress appeared advanced detachments, and on August 3 - the main forces of the Turks. Samoilovich and Grigory Romodanovsky's forces joined on August 10, and only on August 24 they crossed the Sula River on the way to Chigirin. On August 26-27, a skirmish between their and Ottoman troops removed Ottoman observation posts and allowed the rest of the Muscovite and Ukrainian forces to cross the river under the cover of artillery fire. Turkish attempts to drop back into the river the first crossing detachment under the command of Major-General Shepelev were repulsed. Muscovite and Ukrainian cavalry attacked and overwhelmed Turkish-Tatar army camp, on the August 28, inflicting heavy casualties. The following day, Ibrahim Pasha lifted the siege of Chyhyryn and hastily retreated to the Inhul River and beyond. Samoilovich and Grigory Romodanovsky relieved Chyhyryn on September 5. The Ottoman Army had lost 20,000 men and Ibrahim was imprisoned upon his return to Constantinople and Crimean Khan Selim I Giray lost his throne.. How many days after the attack on the Turkish-Tatar army camp did Ibrahim Pasha lift the siege of Chyhyryn?