weakening, Panahali khan, with his detachment consisting of 200 riders, arrived Karabakh, and declared himself an independent khan. At that time, Otuziki, Javanshir and Kebirli tribes, which were forcibly evicted to Khorasan, returned to Karabakh. Elder son of Panahali khan - 15 years old Ibrahim Khalil Khan also escaped from Khorasan to Karabakh, to his father. Strengthening of Panah Khan didn't suit his neighbors’ taste. Haji Chalabi Khan of Sheki drove a newly appeared khan out of Karabakh in that very year, but next year Panahali Khan returned with a strong detachment and destroyed Haji in a stubborn struggle. After this, all Turkic tribes of Karabakh recognized Panahali Khan's power. Turkic tribes Otuziki, Javanshir and Kebirli dwelling in low-lying regions, became a kernel of the Karabakh Khanate. The khanate occupied a significant territory and included low-lying and also mountainous parts of Karabakh. Initially, a residence of khan was Bayat Castle, constructed in 1748. Later the ruler moved to Shahbulag Castle, near modern day Aghdam. In 1751, unapproachable Panahabad fortress, built by Panah Khan, became the capital of the khanate. Ibrahim Khalil Khan After Kerim khan overrode the whole Iran, he called Panahali khan to Shiraz and made him his counselor and his son charged Mehrali bey with ruling Karabakh. In 1759, Panahali khan died in Shiraz. Mehrali bey finished strengthening of Shusha and built new fortresses called Asgaran and Agh-oghlan. Soon he was treacherously murdered by Aghasi khan of Shirvan, after which Ibrahim Khalil Khan-elder son of Panahali khan – asserted himself in Karabakh. His reign began from overriding of fallen meliks, which was lasted till 1787. In that very year, Ibrahim Khalil Khan attempted to conquer Shamakhi, but was defeated by Fatali khan of Quba. In 1795, Ibrahim Khalil Khan, who didn't want to obey Agha Mohammad Khan who conquered whole Iran until then, sent his ambassadors to Russian empress Catherine II to ask for the Russian citizenship. Knowing about these discussions, Agha Mohammad Khan gathered a great army with overall strength of 85 thousand people, went over the Aras River and approached Shusha, in 1795. Ibrahim Khalil Khan, who had only 15 thousand soldiers under his guidance, defended desperately. Siege of the fortress lasted for 33 days, but due to selfless actions of defenders of the fortress, who were ruled by Ibrahim Khalil Khan and his vizier, eminent poet Molla Panah Vagif - Agha Mohammad Khan couldn't conquer