suzerainty of Panakh Khan. Panakh Khan founded the fortress of Shusha at a location recommended by Melik Shahnazar and made it the capital of Karabakh khanate. Agha Mohammad Khan of the Qajar dynasty reasserted firm Iranian suzerainty in the region and all of the wider Caucasus region. However, he was assassinated some years afterwards, increasing political unrest in the region. The meliks did not wish to reconcile themselves to the new situation. They desperately hoped for the aid of the Russians and sent letters to Catherine II of Russia and her favorite, Grigori Potyomkin. Potyomkin gave orders, that "at an opportunity its (Ibrahim-khans of Shusha) area which is made of people Armenian to give in board national and thus to renew in Asia the Christian state". But khan Ibrahim Khalil Khan, the son of Panakh-khan, learned of this. In 1785 he arrested the Dzraberd, Gulistan and Dizak meliks, plundered Gandzasar monastery, and imprisoned and poisoned its Catholicos. As a result of this the Khamsa melikdoms finally broke down. Ibrahim Khalil Khan, the son of Panah Ali Khan, made the Karabakh khanate a semi-independent princedom, which only nominally recognized Persian rule. In 1797, Karabakh suffered the invasion of armies of Persian shah Agha Mohammad Khan Qajar, who had just recently dealt with his Georgian subjects in the Battle of Krtsanisi. Shusha was besieged, but Agha Mohammad Khan Qajar was killed in his tent by his own servants. In 1805 Ibrahim-khan signed the Treaty of Kurakchay with Imperial Russia, represented by the Russian commander-in-chief in the war against Pavel Tsitsianov, under which Karabakh Khanate became a protectorate of Russia and the latter undertook to maintain Ibrahim-Khalil Khan and his descendants as the ruling dynasty of Karabakh. However the following year Ibrahim-Khalil was killed by the Russian commandant of Shusha, who suspected that the khan was trying to flee to Persia. Russia appointed Ibrahim-Khalil's son Mekhti-Gulu as his successor. In 1813, the Karabakh Khanate, Georgia, and Dagestan became possessions of Imperial Russia by the Treaty of Gulistan in 1813, then the rest of Transcaucasia became part of the Empire in 1828 under the Treaty of Turkmenchay, following two Russo-Persian Wars in the 19th century. In 1822, Mekhti-khan escaped to Persia, and returned in 1826 with Persian armies to invade Karabakh. But they could not take Shusha, fiercely defended by Russians and Armenians, and were expulsed by the Russian general Valerian Madatov, himself an