 Promising "Russian protection" and the guarantee that the khans would remain in power in their domains, the khan of Karabakh, Ibrahim Khalil Khan signed an agreement with Tsitsianov on 26 May 1805.After the massacre in Ganja, Mostafa Khan asked the central government in Tehran for assistance, in order to prevent Tsitsianov's advance.The government responded by sending an army under general Pir-Qoli Khan Qajar.