Baku was attacked on 29 July and again the local troops ran away, leaving the Bicherakov Cossacks in the lurch. On 31 July, the Ottomans attacked Hill 905 north-west of Baku at and continued until 2 August. The 10th Caucasian Infantry Division, the 51st Infantry Division, several batteries of artillery and a cavalry regiment arrived but another attack on 5 August failed, with casualties. The 10th Caucasian Infantry Division was withdrawn to rest and the 15th Infantry Division took over. When the Ottomans were about }} from the docks, Bicherakov decided to retreat to Derbent, up the coast but the Ottomans were unaccountably seized by panic and retreated, which encouraged the Armenians to counter-attack, until the Ottomans rallied about }} outside town. Dunsterville also obtained the steamships "President Kruger", "Kursk" and "Argo", to be held ready for a hurried retreat. Fears about the British line of communications were reduced, when the Jangali leader Kuchik Khan made terms on 12 August, which included supplying the British forces.