After the Treaty of Gulistan, which concluded the first stage in the division of Azerbaijan’s territory between the Tsarist and the Persian empires, a further treaty was signed, between the Persian and the British empires against the Tsarist Empire, on November 25, 1814. Under the terms of this treaty, Iran would guarantee India’s security from its borders and Britain would provide Iran with financial and military assistance in return.
In 1823, a cooperation agreement was signed between the Persian and the Ottoman empires, with mediation by the British Empire, in order to end the war between the two empires that had begun in 1821. During that period there had been rebellions in the North Caucasus against the Tsarist Empire, which therefore refrained from engaging in a new war with the Persian Empire. The Tsarist diplomat who was sent to Persia therefore expressed the Tsarist empire’s willingness to hand over part of the Karabakh and Lankaran khanates to the Persian Empire in order to stop the Shah of the Persian Empire from starting a new war. However, the Shah declared war on the Tsarist Empire on December 14, 1825, on the eve of the revoulution in Saint Petersburg. The timing of the declaration of war was considered to be perfect, because while the Tsarist Empire was busy with internal problems it could therefore not defend itself against the Persian Empire. The khans of Azerbaijan’s khanates who had been granted asylum in the Persian Empire after the Treaty of Gulistan had a profound influence on the Shah’s decision to declare war on the Tsarist Empire.
The war began on July 19, 1826 when Abbas Mirza’s military forces attacked Karabakh. The 48-day-long siege of Shusha fortress by the Persian army helped the Tsarist Empire to gain time in order to deploy additional military forces to the region. During that time, Russians were extracted from Ganja, Shaki, and Shamakhi respectively by Ugurlu Khan, Salim Khan, and Mustafa Khan. However, Baku and Lankaran were still controlled by the Tsarist Empire’s military forces. The defeat of the Persian army by the military forces of the Tsarist Empire near Shamkir on September 3, 1826 forced Abbas Mirza to stop besieging Shusha fortress. The defeat of Abbas Mirza in the decisive battle near Ganja on September 13 marked a turning point in the war. The Tsarist Empire’s military forces advanced towards Nakhchivan after taking control of Khudafarin Bridge. Nakhchivan was occupied in June 1827. The Tsarist military forces’ victory at the Battle of Cavanbulag allowed them to occupy Abbasabad, a fortress of strategic importance for protecting Nakhchivan. The occupation of Sardarabad fortress was followed by the capture of Iravan on October 1. The military forces of the Tsarist Empire thus did not face any obstacles while attempting to advance towards South Azerbaijan. Tabriz was occupied on October 13. The negotiations between the Tsarist and the Persian empires, with British mediation, in November did not end successfully. The occupation of Urmia and Ardabil in January 1828 forced Fath Ali Shah to begin new negotiations with the Tsarist Empire.
On February 10, 1828, a peace treaty was signed between Abbas Mirza and General Paskevitch in the village of Turkmenchay. The Treaty of Turkmenchay consisted of 16 articles. Under the terms of Article III, the Nakhchivan and Iravan khanates were annexed to the Tsarist Empire. As it was in the Treaty of Gulistan, only Tsarist Empire possessed an exclusive right to have warships on the Caspian Sea in accordance to the Article VIII of the Treaty of Turkmenchay. Article VI in turn, specified that the Persian Empire agreed to indemnify the Tsarist Empire by handing over 20 million silver coins. Russian merchants were given special privileges and exclusive rights to conduct trade within the Persian Empire. Article XV of the Treaty of Turkmenchay was especially dealing with the condition, migration in case of necessity, and resettlement of population in accordance to the new regulations.
As a result of efforts by A.S.Griboyedov and General J.F.Paskevitch, Armenians who had been brought from the Persian Empire were resettled in Azerbaijan by the Tsarist Empire under the terms of Article XV in the Treaty of Turkmenchay. The settlement of Armenians in North Azerbaijan by the Tsarist Empire was not a coincidence. It was envisaged in the Decree by Peter I that was issued on November 10, 1724. In order to carry out this plan, favorable conditions and opportunities were created in 1820s and 1830s. After the occupation of the Iravan Khanate, arrangements were made to provide a legal basis for this migration process. A.S.Griboyedov, Tsarist Empire representative to the Persian Empire, played a crucial role in the realization of the migration plan that was prepared by an Armenian called Catholicos Nerses. Griboyedov’s letter to the Tsar contains valuable information regarding the migration plan. In March 1828, a month after the Treaty of Turkmenchay was signed, 700 Armenian families were resettled in Azerbaijan’s Karabakh-Barda region. The Committee on Migration that was formed especially for this issue settled the Armenian population on the northern side of the Aras river, mainly in the Karabakh, Iravan, and Yelizavetpol (Ganja) regions of Azerbaijan. The Armenians who migrated were given special privileges. These Armenians were exempted from all kinds of taxes and duties and were given a 25-ruble monthly allowance per person for the following six years. The allowances were allocated from the indemnity that was paid by the Persian Empire. Between 1828 and 1930, 40,000 Armenians from the Persian Empire and 85,000 Armenians from the Ottoman Empire were resettled in Azerbaijan. For the settlement of Armenians 200 thousand-dessiatine land was allocated from the land of Treasury. In addition, special territories were purchased from Muslim landowners for 2 million manats of the time. In 1911, Russian historian N.Shavrov wrote that around 1.3 million Armenians were living in the South Caucasus at the beginning of the 20th century and more than one million of these Armenians resettled in these territories as a result of the migration policy of Tsarist Russia.
The signing of the Treaty of Turkmenchay put an end to fighting between the Tsarist and the Persian empires. This treaty officially ended Azerbaijan’s division into two parts. The Tsarist Empire intended to create a stronghold in Azerbaijan’s occupied territories. Different ethnic groups and nations from neighboring countries settled in Azerbaijan as a result of the migration policy of Tsarist Empire, which significantly influenced and seriously changed the ethnic composition and demographic situation of Azerbaijan’s population. On the question of the settlement of Armenians in Azerbaijan, Griboyedov wrote that after a while Armenians will claim that the territories they are settled in as a result of the Tsarist Empire’s migration policy belongs to them. Griboyedovos prediction thus came true, and Armenia began territorial claims against Azerbaijan, which led to definite controversies among the local population. And from 1828, the Tsarist Empire purposefully pursued its activities, together with Armenians, for creating an ‘Armenian province’ in the Nakhchivan and Iravan khanates, in line with its migration policy and its intention of creating a buffer zone along its border with the Ottoman Empire.
 “İran və İngiltərə arasında Tehran müqaviləsi”, in Yaqub Mahmudov and Kərim Şükürov (eds.), Azərbaycan beynəlxalq münasibətlər və diplomatiya tarixi (1639-1828)-Dövlətlərarası müqavilələr və digər xarici siyasət aktları, Vol. 1 (Bakı: Regionların inkişafı ictimai birliyi, 2009), pp. 449-453.
 “Osmanlı imperiyası və İran arasında Ərzurum müqaviləsi”, in Mahmudov and Şükürov (eds.), Azərbaycan beynəlxalq münasibətlər və diplomatiya tarixi (1639-1828), pp. 481-487.
 Azərbaycan tarixi, Vol. 6, (2007), pp. 42-46.
 Umudlu, Vidadi, Şimali Azərbaycanın çar Rusiyası tərəfindən işğalı və müstəmləkəçilik əleyhinə mübarizə (1801-1828) (Bakı, 2004), pp. 144-157-166-170.
 “Türkmənçay müqaviləsi”, in Mahmudov and Şükürov (eds.), Azərbaycan beynəlxalq münasibətlər və diplomatiya tarixi (1639-1828), pp. 493-503. See also: “Rusiya-İran Türkmənçay müqaviləsi. 10 fevral 1828-ci il”, in T.K.Heydərov, T.R.Bağırov, K.K.Şükürov, (eds.), Qafqazda “erməni məsələsi”. Rusiya arxiv sənədləri və nəşrləri üzrə, (Three Volume), Vol. 1, (Bakı: “Elm” nəşriyyatı, 2010), pp. 55-66.
 Грибоедов, А.С., Горе от ума. Писма и записки (Баку, 1989), p. 338. See also: Qlinka, S.N., Azərbaycan ermənilərinin Rusya hududlarına köçürülməsinin təsviri (Bakı: Azərbaycan nəşriyyatı, 1995), pp. 42-46-92.
 Шавров, Н.Н., Новая угроза Русскому делу Закавказе: Престояшая распродажа Мугани инородцам (Баку, 1990), pp. 59-64.
 Грибоедов, Горе от ума. Писма и записки, p. 338.