men. The Armenian population of Karabakh also actively participated in this struggle against the Iranians and fought side by side with the Muslim population, jointly organizing ambushes in the mountains and forests. The siege lasted for 33 days. Not being able to capture Shusha, Agha Mohammad Khan ceased the siege and advanced to Tiflis (present-day Tbilisi), which despite desperate resistance was occupied and exposed to unprecedented destruction. Ibrahim Khalil Khan eventually surrendered to Mohammad Khan after negotiations, including the paying of regular tribute and to surrender hostages, although the Qajar forces were still denied entrance to Shusha. Since the main objective was Georgia, Mohammad Khan was willing to have Karabakh secured by this agreement for now, for he and his army subsequently moved further. In 1797, Agha Mohammad Shah Qajar, having successfully resubjugated Georgia and the wider Caucasus and having declared himself shah, decided to carry out a second attack on Karabakh. Trying to avenge his previous humiliating defeat, Agha Mohammad Shah devastated the surrounding villages near Shusha. The population had not recovered from the previous 1795 attack and also suffered from a serious drought which lasted for three years. The artillery of the attackers also inflicted serious losses on the city defenders. Thus, in 1797 Agha Mohammad Shah succeeded in seizing Shusha and Ibrahim Khalil Khan had to flee to Dagestan. However, several days after the seizure of Shusha, Agha Mohammad Khan was killed in mysterious circumstances by his bodyguards in the town. Ibrahim Khalil Khan returned to Shusha and ordered that the shah's body be honourably buried until further instructions from the nephew and heir of Agha Mohammad Shah, Baba Khan, who soon assumed the title of Fath-Ali Shah. Ibrahim Khan, in order to maintain peaceful relations with Tehran and retain his position as the Khan of Karabakh, gave his daughter Agha Begom, known as Aghabaji, as one of the wives of the new shah. Within the Russian Empire From the early 19th century, Russian ambitions in the Caucasus to increase its territories at the expense of neighbouring Qajar Iran and Ottoman Turkey began to rise. Following the annexation of Georgia in 1801, some of the khanates agreed to become Russian protectorates in the immediate years afterwards. In 1804, the Russian general Pavel Tsitsianov directly invaded Qajar Iran, initiating the Russo-Persian War of 1804–1813. Amidst the war, in 1805, an agreement was made between the Karabakh Khanate and