In late May, facing Baratov was assigned to the XIII Corps commanded by colonel Ali İhsan Bey, who began his advance. Meanwhile, on the Russian side, Baratov was hoping to capture Khanaqin and move down to Baghdad, which could have been taken by the Russians as the Turks and the British were busy with fighting each other. On June 3, he forced Khanaqin once again, but this time the balance had changed. The Ottoman XIII Corps successful repulsed Baratov's forces, and did not leave it there; soon the counter-offensive that was planned launched. Ali İhsan Bey captured Kermanshah on 2 July and took Hamadan on 10 August. Having lost half of his men, Baratov was forced to retreat north. Baratov stopped at the Sultan Bulak range. In August 1916, the gendarmes return to Kermanshah.