 Complete the following phrase:  In 1795 the ruler of Iran, Agha Mohammad Khan Qajar, attacked the region to bring it again within influence of the Iranian empire. The khans of Ganja, Nakhjavan, and Erivan submitted, but Ibrahim Khan did not. He was defeated in battle and retreated to the fortress of Shusha. After a 31 day long siege from July 8 to August 9, Agha Mohammad Khan Qajar failed to take the fortress and left the region. In a verbal truce, Ibrahim Khan acknowledged Qajar supremacy and was permitted to continue to rule as Khan of Karabakh. In 1796, following Agha Mohammad Khans return to mainland Persia, Catherine the Great ordered her army to conquer the Caucasus. Ibrahim began negotiating with the Russian commanders and agreed to cooperate with them in exchange for maintaining his rule in Karabakh. Soon after Catherine the Great died, her successor, Paul, abandoned her plans for the region and recalled the Russian troops. Using opportunity, Ibrahim and Heraclius teamed up again, this time to invade Ganja Khanate, since its ruler Javad Khan joined Qajar Army in their 