When Nadir Khan Efshar declared himself Shah on February 26, 1736, he expelled the Javanshir, Otuzikili and Kabrili tribes in Karabakh that were against his reign to Khorasan and held the leaders of these tribes hostage. According to Mirza Adigozel bey, Nadir Shah also sent Fazlaly Bey, the first son of Karabakh Khan Ibrahimkhalil Agha, into exile in Khorasan. However, Fazlaly Bey expressed his anger at the forced removal of the Karabakh population and opposed Nadir Shah’s exile plan, which resulted in Nadir Shah ordering Fazlaly Bey to be executed and appointing his brother, Panah Ali Bey, in his place. Although Panah Ali Bey gained Nadir Shah’s respect for his service in the shah’s palace, he was afraid that Nadir Shah might execute him, as he had his brother, due to slander and accusations by the courtiers. Therefore, when Nadir Shah was travelling, he managed to flee the palace and travel to Karabakh while using the visit of his family in Khorasan as a pretext. The Shah was informed about his escape, and he sent couriers after him to prevent him from running away. He also instructed the leaders of Ganja, Tiflis, and Shirvan to capture Panah khan wherever they saw him and send him to the shah’s palace. However, all Nadir Shah’s efforts were unsuccessful. Panah Ali Bey managed to free himself from Nadir Shah’s persecution by hiding in the Karabakh Mountains and near Shaki Fortress.
The overthrow of Nadir Shah on June 20, 1747 by his own courtiers and the beginning of the struggle within the country in order to gain the reign brought an end to the country created by Nadir Shah. The power struggle and internal turmoil in Iran caused by the death of Nadir Shah became a turning point for Azerbaijan. Although, there was a possibility to create a centralized state in Azerbaijan, the existence of feudal fragmentation, weakness of the economic relations, and preponderance of the natural economy hindered the unification in terms of the unified and centralized state. As a result, Azerbaijan disintegrated into independent and semi-independent khanates and sultanates (small kingdoms or city states). As well as the collapse of Nadir Shah’s empire, the power struggle between Tsarist Russia and the Ottoman Empire in the mid-eighteenth century, which prevented these powerful forces from intervening in the internal issues of Azerbaijan, paved the way for the creation of these independent and semi-independent khanates and sultanates. During that period, 20 khanates, including the Karabakh Khanate, and six sultanates were created in the territory of Azerbaijan.
After the death of Nadir Shah, Panah Ali Bey returned to Karabakh and began a political project, which resulted in the establishment of the above-mentioned Karabakh Khanate. Panah Ali Bey declared himself Khan of this Khanate. When the Khanate was formed, Panah Ali Khan’s main goal was to strengthen it. His first measure was thus to reintegrate the tribes that had been exiled by Nadir Shah to Khorasan. The return of displaced tribes and families and their resettlement in their native land strengthened the Karabakh Khanate. After gaining the support of the local Azerbaijani tribes in the region, Panah Ali Khan began to act as the sole leader of Karabakh. He managed to unify not only his own Javanshir tribe, but also all other tribes living in the Karabakh region of the Safavid Empire’s former Ganja-Karabakh Beylerbeylik. Regarding the Khanate’s foundation date, Mirza Adigozle bey, Ahmad bey Javanshir, and Mir Mehdi Khazani, all well-known historians of the Karabakh Khanate, note that it was created in 1747.
Regarding the ancestry and ethnic origin of Panah Ali Khan all relevant sources assert that he was from the Sarijali branch of the Javanshir tribe that came from Turkistan and settled in the Karabakh region of Azerbaijan.
During Panah Ali Khan’s reign, Bayat and Shahbulag fortresses were built, and Shusha (also known as Panahabad) was founded (1751-1756). In 1759, Fatali Khan Afshar, the Khan of Urmia Khanate, sent his envoys to Panah Ali Khan with the order to subordinate him. However, Panah Ali Khan rejected his order. When Fatali Khan got the negative answer, he directed to Karabakh Khanate with great troops and encircled Shusha. After a six-month siege, Panah Ali Khan accepted Fatali Khan’s order and handed over his son, Ibrahimkhalil Agha. Soon? Kerim Khan Zend began to fight against Fatali Khan Afshar and tried to get assistance from the rivalries of the Fatali Khan, including Panah Ali Khan. While seeing this invitation of Kerim Khan as a chance to revenge from Fatali Khan Afshar and liberate his son Ibrahimkhalil Agha, Panah Ali Khan appointed his little son Mehrali Bey to his own post temporarily and went to Urmia in order to help Kerim Khan Zend. In 1763, after nine months long besiege Fatali Khan was defeated. Ibrahimkhalik Agha was freed from the prison and went back to Karabakh. However, Kerim Khan did not allow Panah Ali Khan to return to Karabakh. He took all khans of Azerbaijan, including Panah Ali Khan, with him to Shiraz and Panah Ali khan stayed in there until the end of his life (1763). His corpse was brought back to Karabakh and buried in Agdam.
After Panah Ali Khan’s death in 1763, his son Ibrahimkhalil Agha became the khan of the Karabakh Khanate (1763-1806). During Ibrahimkhalil Khan’s reign, the Khanate became even stronger. Although, the Karabakh Khanate subjected to military attacks by the Fatali Khan, the Khan of Guba Khanate, three times and Agha Muhammed Shah Qajar two times during the reign of Ibrahimkhalil Khan, he managed to preserve and defend the independence oh the Karabakh Khanate. Ibrahimkhalil Khan built strong ties with the Ottoman Empire. In 1805, Ibrahimkhalik Khan signed the Kurakchay Treaty, by which the Karabakh Khanate was incorporated officially into the Russian Tsarist Empire. Although Ibrahimkkhalil Khan initially accepted these changes in order to be part of the Tsarist Empire, he was later felt a quick repentance. During political turbulence in 1806, Russians killed Ibrahimkhalil Khan, together with 17 family members and associates, in the summer of that year in Khankendi, and his son Mehdigulu became khan of the Karabakh Khanate. Realizing the illegitimacy of the Russian officers’ actions, the official authorities of Tsarist Russia gave Mehdigulu Khan the rank of major-general in order to appease the population, and presented him with “royal credentials” for the Karabakh khanate. However, later on Mehdigulu Khan escaped to Iran after understanding his decisive by Russians and the Karabakh Khanate was officially abolished by the decree of Russian Tsar in 1822.
 Cavanşir, Əhməd bəy, “Qarabağ xanlığının 1747-1805-ci illərdə siyasi fəaliyyətlərinə dair”, in Akif Fərzəliyev (ed.), Qarabağnamələr (Bakı: Yazıçı, 1989), p. 157.
 Adıgözəl bəy, Mirzə, “Qarabağnamə”, in Akif Fərzəliyev (ed.), Qarabağnamələr (Bakı: Yazıçı, 1989), pp. 31-32. See also Qarabaği, Mirzə Camal Cavanşir, “Qarabağ tarixi”, in Akif Fərzəliyev (ed.), Qarabağnamələr (Bakı: Yazıçı, 1989), p. 110.
 Xəzani, Mir Mehdi, “Kitabi-tarixi-Qarabağ”, in Nazim Axundov (ed.), Qarabağnamələr, Vol. 2 (Bakı: Yazıçı, 1991), p. 106. See also: Axundov, Nazim, Qarabağ salnamələri (Bakı: Yazıçı, 1989), p. 32.
 Xəzani, “Kitabi-tarixi-Qarabağ”, p. 107.
 Bakıxanov, Abbasqulu Ağa, Gülüstani İrəm (Bakı, 1951), pp. 158-159. See also: Xəzani, “Kitabi-tarixi-Qarabağ”, p. 104. See also: Azərbaycan tarixi, Vol. 3, (1999), p. 387.
 Adıgözəl bəy, “Qarabağnamə”, p. 33.
 Cavanşir, “Qarabağ xanlığının 1747-1805-ci illərdə siyasi fəaliyyətlərinə dair”, p. 158.
 Xəzani, “Kitabi-tarixi-Qarabağ”, p. 114.
 Adıgözəl bəy, “Qarabağnamə”, p. 31. See also: Qarabaği, “Qarabağ tarixi”, p. 110. See also: Qarabaği, Mirzə Yusif, “Tarixi-Safi”, in Nazim Axundov (ed.), Qarabağnamələr (Bakı: Yazıçı, 1991), pp.12-14.
 Qarabaği, “Tarixi-Safi”, p. 15.
 Adıgözəl bəy, “Qarabağnamə”, p. 35.
 Bakıxanov, Gülüstani İrəm, p. 158.
 Qarabaği, “Qarabağ tarixi”, p. 119. See also: Mirzə Camaloğlu, Rzaqulu bəy, “Pənah xan və İbrahim xanın Qarabağda hakimiyyətləri və o zamanın hadisələri”, in Nazim Axundov (ed.), Qarabağnamələr (Bakı: Yazıçı, 1991), p. 217. See also: Fəna, Mirzə Rəhim, “Tarixi-Cədidi-Qarabağ”, in Nazim Axundov, (ed.), Qarabağnamələr (Bakı: Yazıçı, 1991), p. 256. Əlizadə, Həsən İxfa, “Şuşa şəhərinin tarixi”, in Nazim Axundov, (ed.), Qarabağnamələr (Bakı: Yazıçı, 1991), p. 325.
 Dedeyev, Bilal, “Karabağ Hanlığı (1747-1822)”, Türk Dünyası Araştırmaları, No. 136, 2002, pp. 39-44.
 “Rusiya və Qarabağ xanlığı arasında Kürəkçay 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. 365-376.
 Mustafazadə, Tofiq, Qarabağ xanlığı (Bakı: Sabah, 2010), pp. 209-210.