At the end of the 18th century, the struggle for influence in South Azerbaijan intensified between Iran, Ottoman Turkey and Tsarist Russia. When Kartli-Kakheti was annexed to Russia in 1801, the lands of Gazakh, Borchali, Shamshadil and Pambak in Azerbaijan also joined Russia. From 1803, Russia openly began to occupy Azerbaijan. General Sisianov's troops captured and destroyed Balakan.
According to the "Oath of Allegiance" signed on April 12, 1803, the Tsar-Balakan community joined Russia. However, in 1804 the population revolted, a Russian general and hundreds of soldiers were killed. General Sisianov again sent troops into the region and put down the revolt. When the Russian army occupied Shamkir, Ganja khan faced Javad khan.
In January 1804, the city of Ganja was occupied and Javad khan was killed. Ganja khanate was abolished, the name of the city was changed (Yelizavetpol). In 1804, the First Russia-Iran (Gajar) War began. The army was led by Abbas Mirza by the Gajars. In 1804, General Sisianov's plans to occupy Irevan failed, and Russian troops were forced to retreat.
On May 14 and 21, 1805, the Kurakchay Treaty was signed between Russia and the Karabakh Khanate and between Russia and the Sheki Khanate. According to the treaty, both khanates became vassals of Russia.
On December 27, 1805, the same agreement was signed between the Shamakhi Khanate and Russia. The Russians' plan to capture Baku by attacking from the sea failed. As a result, on February 8, 1806, during a meeting between the Baku khan and Sisianov, Sisianov was killed.
In the summer of 1806, Ibrahimkhalil khan, the Karabakh khan, was killed by the Russians. In response, riots broke out throughout Azerbaijan. On May 14 and 21, 1805, the Kurakchay Treaty was signed between Russia and the Karabakh Khanate and between Russia and the Sheki Khanate. According to the treaty, both khanates became vassals of Russia.
On December 27, 1805, the same agreement was signed between the Shamakhi Khanate and Russia. The Russians' plan to capture Baku by attacking from the sea failed. As a result, on February 8, 1806, during a meeting between the Baku khan and Sisianov, Sisianov was killed.
In the summer of 1806, Ibrahimkhalil khan, the Karabakh khan, was killed by the Russians. In response, riots broke out throughout Azerbaijan. On October 18, 1812, Abbas Mirza was defeated in the Battle of Aslanduz. On January 1, 1813, the Lankaran khanate was occupied.
According to the Gulustan Treaty signed on October 12, 1813 in the village of Gulustan in Karabakh, the First Russian-Iranian war was ended, other Northern Azerbaijani lands except Irevan and Nakhchivan were given to Russia, and only Russia could maintain a navy in the Caspian Sea.
The establishment of the Russian colonial regime in Northern Azerbaijan was entrusted to the commander of the troops here, General A. Yermolov. He gathered around him officers and officials of Armenian origin, abolished the khanates and established a cruel regime. In 1826, a strong revolt against the colonial regime took place in Azerbaijan. In 1826, the Second Russian-Iranian War began, and the troops of Prince Abbas Mirza were re-introduced into Azerbaijan.
The khanate regime was restored in northern Azerbaijan. These uprisings went down in history as "all-Muslim uprisings." The emperor dismissed A. Yermolov and appointed General Ishpaskevich in his place.
On September 13, 1826, in the battle of Ganja (Yelizavetpol), the Russians defeated Abbas Mirza. In June 1827, Nakhchivan was occupied. On October 1, 1827, Irevan was occupied.
At the beginning of 1828, Russian troops attacked South Azerbaijan, and Marand, Tabriz, Urmia, and Ardabil were occupied.
On February 10, 1828, a treaty was signed in the village of Turkmenchay near Tabriz. According to him, the Second Russian-Iranian War is over, all Northern Azerbaijan, including Irevan and Nakhchivan, is given to Russia, and Iran had to pay an additional 20 million silver manats. According to Article 15 of the agreement, Armenians were to be resettled on Azerbaijani lands. According to the agreement, Azerbaijan was divided into two parts and lost its statehood.