The founder of the Karabakh Khanate is Panahali Khan. He was from the Sarijali tribe, belonging to feudal nobles of the Javanshir tribe. The ruler of the Otuzikiler tribe and the emir of some 20 thousand crews of Javanshir and Gazakh, Panahali Khan was extremely rich and had great influential power.
Panahali Khan was recruited during Nadir’s rule in Azerbaijan. He and his brother Fezleli Bey helped Nadir with cleaning Azerbaijan’s territories from the Turkish and was rewarded. Cautious about brothers so courageous and with big influence among the people staying in Karabakh, Nadirgulu Khan invited them to Iran to serve in the palace. In the shah’s palace, Fezleli Bey was appointed eshikaghasi (a title and post; a chief person in palace affairs) and Panahali Bey an army emir.
The moving of a large part of Karabakh’s people to Khorasan and Afghanistan worried Panahali Bey and Fezleli Bey, who were working in the shah’s palace. Fezleli Bey’s protest against the forceful deportation of Karabakh’s people resulted in his execution by the shah. Shah was intending to appoint Panahali Bey to the post of eshikaghasi. Knowing about the shah’s treacherous intentions, in 1738, Panahali Bey left the palace with a group of close people and moved to his native land Karabakh.
Nadir shah’s death created large opportunities for Panahali Bey, as it did for many feudalists. He founded the Karabakh khanate in the west part of the Karabakh beylerbeylik (a form of small administration and control, similar to a khanate, but much like a vassal state, but not a state) and declared himself the khan (1748-1763). To save the Karabakh khanate from Iran and from the enemy feudalists, he built the Bayat palace in the Kebirli province and khan moved there with all his family and Karabakh’s nobles. The people of surrounding villages, in addition, many artists from Tebriz and Ardabil settled here. Seeing the Karabakh khanate’s rising strength and the construction of the Bayat palace, other governors and khans rose against Panahali Khan. Among them, Sheki’s khan Haji Chelebi Khan decided to fight fiercely against Panahali Khan. He gathered a lot of troops, surrounded the Bayat palace and attacked several times. But, Panahali Khan, who had learned about the attack beforehand, had armed his relatives and Karabakh’s local people (called “elats”, signifying “Karabakh’s people”) and prepared them for war. Despite the siege continued for over a month, Panahali Khan’s enemies could not capture the palace. When returning, having incurred great losses, Haji Chelebi had said in disappointment: “Panahali Khan had declared himself the khan, but I confirmed his khanate with my defeat.” After the victory over the Sheki khanate, in the 50th years of the XVIII century, Panahali Khan broke the resistance of Karabakh’s armenian meliks and subordinated them to himself, and expanded the territory of his khanate. Short while later, new attacks of Azerbaijani and Iranian governors forced Panahali Khan to build a new, stronger palace. In 1750, construction of this palace started on a high, steep mountain and in the years 1756-1757, building of the palace was completed. This palace was initially named Panahabad, after the name of the khan who had built it and later was renamed Shusha.
During Panahali Khan’s rule, the Shusha palace was one of Azerbaijan’s administrative, trading and professionalism centers. A road for caravans, linking the Front Caucasus with Iran and other countries, passed through Shusha.
Panahali Khan was intending to use the broadening internal wars between Nadir Shah’s descendants, in order to capture the Ganja, Iran, Irevan, Nakhchivan and especially the Ardabil khanates. Within a short period, he succeeded in putting them under his control through force and betrothal diplomacy (establishing family ties). He appointed Derjahgulu Bey from Sarija the governor to Ardabil, and the descendants of Ganja’s Ziyadoghlu dynasty the governor to Ganja. Panahali Bey was expanding his territory toward South-East. And in South-West, he had taken away from the Karabakh and Nakhchivan governors the lands stretching up to Bergushad - the Tatev, Sisyan, Gafan, Mehri and Guney provinces. He captured the Goycha province, which was dependent on Irevan’s governor and occupied Terter’s territory. He joined to his circle of influence the lands stretching from the Khudaferin Bridge to Kurekchay, which were under Ganja’s rule. He brought the Kengerli tribe of Nakhchivan, the Demirchi-Hassanli people in Georgia, Garagoyunlu and Jinni tribes to obedience. Zengezur’s Hajishamli, Kolani and Chalbeir provinces also obeyed the Karabakh khanate.
In the 50th years of the XVIII century, while Panahali Khan was busy fortifying the khanate, Karabakh had been subjected to numerous attacks of the neighboring feudalists. In 1751, Mohammedhassan Khan Gajar’s troops attacked Karabakh. He set up a camp not far from Shusha and stayed there for about a month. According to a historian from Karabakh Mirza Jamal’s information, Mohammedhassan Khan “thought long about making Panahali Khan obey and taking the Shusha palace, took precautions… but, he could not approach the palace with so many troops. On the contrary, Karabakh’s brave people, either openly or secretly, robbed the horses and other animals of Mohammedhassan Khan’s troops and did them great damage.” Sheki’s governor Safarali Khan did not play little role in defeating Mohammedhassan Khan’s forces either. Taking advantage of Mohammedhassan Khan’s presence in Azerbaijan, in that year, Kerim Khan Zand attacked Astarabad, Gilan and Mazandaran, which were controlled by Mohammedhassan. After learning about it, Mohammedhassan Khan was forced to abandon Shusha’s siege and return.
A while later, after uniting several neighboring khanates (Tebriz, Khoy, Marand, Garadagh etc.) around himself, in 1760, Urmiya’s governor Fatali Khan Afshar sent an envoy to Panahali Khan and demanded he obeyed, but received rejection. Then, Fatali Khan Afshar started an attack on the Karabakh Khanate with a large troop. Capturing the defenseless villages and provinces he arrived in the Shusha palace and surrounded the palace. After Shusha had stayed in the siege for six months, Panahali Khan freed the town by giving his son as hostage.
In 1761-1762, Kerim Khan Zand, who had united Iran’s various counties under his government, started an attack on Azerbaijan. He defeated Fatali Khan Afshar’s troops in a battle near the village of Garachemen and made Azerbaijan’s several khanates obey him. Fatali Khan retreated to the Urmiya palace.
Trying to take advantage of the opposition between Azerbaijani khanates, Kerim Khan Zand tried to draw local khans and feudalists, who were once oppressed by Fatali Khan, to his side by sending them a letter. Kerim Khan Zand wrote in his letter to Panahali Khan: “Not only is Fatali Khan enemy with you, he is also blood-feud enemy with us… You must not hold back your power for unity. Exactly this way, you can get revenge and save your son. With this both you will be happy and our wish will be fulfilled.”
In reply to this appeal, Panahali Khan appointed his younger son Mehrali Khan the governor in place of himself and, with his troops, joined the Zands. Soon, the town of Urmiya was surrounded by the allied troops. After resisting for several months, Fatali Khan could not resist the united troops’ heavy strike and surrendered in February of 1763. After his victory over the Urmiya khanate, Kerim Khan betrayed Panahali Khan and did not allow him to return to Karabakh, bringing in various excuses. In return, he freed his son Ibrahimkhalil Khan from prison and sent him back to Karabakh. Ibrahimkhalil Khan started to control the khanate. Panahali Khan was taken to Shiraz and stayed there until the end of his life (1763).
During the government of Ibrahimkhalil Khan (years 1763-1780), the khanate became even stronger. Its influence spread to southern khanates of Azerbaijan, and at certain times, also to the Ganja khanate. His reliable ally was Nutsal Khan’s son, Umma Khan, the leader of the Jar-Balaken people. Ibrahimkhalil Khan had married his sister and this family tie had resulted in the creation of military-political unity.
Ibrahimkhalil Khan had married her daughter Tutu Bike khanoum to Selim Khan from Sheki. Using precisely their power, Ibrahimkhalil Khan put an end to the treachery of armenian meliks and the attacks of neighboring khanates on Karabakh, stability was established inside and outside of the khanate, the people started to engage in peaceful labor.
Ibrahimkhalil Khan was friends with the Georgian tsar Irakli II and had married his vizier’s daughter. In order to strengthen the friendship ties with Irakli II, the chief vizier of the khanate, famous Azerbaijani poet Molla Penah Vagif had gone to Tiflis. The treaty between the Karabakh khanate and the Georgian reign, which was signed with his participation, had a political importance.
In years 1760-1780, the struggle for power with his brother Mehrali Khan ended with Ibrahimkhalil Khan’s victory. Thus, having put his internal affairs in order, he started military trips. The first of these is the trip to Nakhchivan. Ibrahimkhalil Khan, with the help of his ally Umma Khan, moved an army to Nakhchivan, stopped in Karabakhlar and surrounded it. Irevan’s khan sent Zeynal and Garapapag kurds to Nakhchivan’s aid. That is why Ibrahimkhalil Khan faced strong resistance in Nakhchivan and retreated to Karabakh. After that, he kept friendly relationships with Nakhchivan’s khan, Kelbeli Khan.
Ibrahimkhalil Khan’s second trip was the trip to Khoy. In 1789, he moved toward Khoy with the allied troops and entered Marand. Khoy’s governor Jafargulu Khan, together with his people, resisted him. The sides faced each other near Marand, a severe battle took place, Karabakh’s troop was defeated, and many people were taken prisoners. Among them were Molla Penah Vagif and Ibrahimkhalil Khan’s cousin Ferzi Bey. The prisoners were taken to Khoy city. Ibrahimkhalil Khan engaged in talks with Jafargulu Khan and freed his people from imprisonment. A friendship contract was signed between the two khanates. Molla Penah Vagif wrote with regards to this event: “I made it back from the battle in one piece, I swear not to leave the palace until the day of apocalypse.”
In the later years, a conflict happened between Ibrahimkhalil Khan and the governor of a Georgian province. Because of this conflict, in 1791, Umma Khan rallied to Georgia with a large troop and captured Sighinag and Gumuskhana, and spent the winter in Akhalsikhi. On the way back, he captured the Adkhan palace, in which knyaz (Russian sovereign) Abashidze was living with his family, and massacred its people with swords. He took Abashidze’s daughter prisoner and sent her to Ibrahimkhalil Khan and married the other daughter. The relatively calm flow of political events and the halt of attacks did not last long.
Agha Mohammed Shah Gajar’s attack to Azerbaijan
After Kerim Khan Zand’s death (1779), in the inter-feudalist wars that took place in Iran, the Gajar dynasty, turk-gizilbash (Azerbaijan) by origin, achieved victory. From the middle of 1780’s, Agha Mohammed Shah conquered principal regions of Iran, with the exclusion of Khorasan, and declared Tehran his capital. In 1794, he sent an army of 8,000 to Karabakh. But the troops was defeated near the Asgeran palace and retreated.
Like the Safavid shahs, Agha Mohammed Shah Gajar wanted to make all of Front Caucasus obey him. Before starting his rallies, he sent commands to all khanates of Azerbaijan, Kartli and Kakhetiya reigns, also to Southern Daghestan, asking them for pledges. He asked Ibrahimkhalil Khan to give his son as the sign of obedience. However, majority of the feudalist governors of the Front Caucasus and Daghestan refused to bow to Iranian cruelty again. This became an excuse for Agha Mohammed Shah to attack the Front Caucasus with a large army. He ordered his troops to march in three directions: in the direction of Talish, Irevan and Shusha. Agha Mohammed Shah was the leader of the troop moving in the last direction.
The Iranian troops moving in the direction of Talish and Irevan destroyed those places and joined with Agha Mohammed Shah’s troops. At the end of June ‘1795, Agha Mohammed Shah forced himself into Karabakh with an army of 85 thousand and surrounded the Shusha palace. This attack was dangerous for the whole of the Caucasus. Therefore, Azerbaijanis rose to a persistent resistance against the invaders. 15,000 of the khanate’s selected population were fighting with the enemy. Seeing that the siege of the palace was not resultant, Gajar was burning the surrounding villages, driving away cows and other animals, and taking people prisoners. He kept Shusha in siege for 33 days, but did not gain any success. When this happened, he moved toward Tiflis. Confrontations in the Kartli-Kakhetiya palace allowed Gajar to enter Tiflis city. The Iranian army captured the city in one battle, massacred its people and took 20,000 prisoners. After a while, the enemy’s army moved to Mughan to pass the winter. Agha Mohammed Shah wrote letters full of threat to Azerbaijani and Daghestani governors again and demanded them to obey. This time, several khanates of Azerbaijan appealed to Russia for help.
The appeal of local governors to Yekaterina II resulted in Russian troops’ military marches to the Front Caucasus in that year. The control of the Russian marine in the Caspian Sea was also given to V.Zubov, who was the commander of the Russian troops. When Agha Mohammed Shah saw the Russian troops moving to Azerbaijan, he quickly retreated to the other side of river Araz in the spring of 1796. That year, he declared himself Iran’s shah.
The death of Yekaterina II in 1796 affected the political situation in the Caucasus. Succeeding to the throne in 1797, Pavel I called back the Russian troops in Azerbaijan and Daghestan.
Taking advantage of the departure of Russian troops from Azerbaijan, in summer of 1797, Agha Mohammed Shah crossed the river Araz and approached Shusha. The Karabakh khan was capable of resisting. When he was returning, having attacked the enemy cannon base, he found the palace door closed. Khan was betrayed inside the palace. Therefore he had to flee to Jar-Balaken, to Umma Khan’s place. After Ibrahimkhalil Khan left Shusha and moved to the North of Azerbaijan, Agha Mohammed Shah sent a letter to the people of Shusha and offered them to surrender. After a long lasting argument, the leader of the religion officials of Karabakh, the chief religion scientist Haji Babek went to the shah’s camp. The shah notified that the people of Shusha had to collect 500,000 eshrefis (unit of currency) worth of tolls. But Haji Babek managed to lower it to 200,000 eshrefis.
After occupying Shusha, Agha Mohammed Shah settled in the house of Ibrahimkhalil Khan’s elder son Mohammed Khan. He appointed Ibrahimkhalil Khan’s prisoner and enemy Mohammed Bey the governor to Shusha.
With the invasion of Karabakh by Agha Mohammed Shah, North Azerbaijan’s situation changed. Shah’s supporters were rising and becoming the ruling power. The khans who kept in touch with Russian khans or worked for them were persecuted. Because he was busy with the internal events that had taken place in the khanate, Ganja’s Javad Khan could not resist the shah. Javad Khan and the Baku khan Hussaingulu Khan, who were hopeful of their previous services, were called to Shusha with the shah’s order and put under supervision. Shamakhi’s khan Mustafa Khan and Sheki’s khan Selim khan notified their obedience through messengers. Guba’s Sheykhali Khan was present at Gajar’s, because, shah had promised to give him the control of the Baku khanate.
And the Iranian army, in its turn, were torturing and robbing the people after entering the city. Hundreds of people resisting Gajar were sent to prison. Among them was Molla Panah Vagif. He was awaiting execution.
Soon, on July 4 ‘1797, an assassination against Agha Mohammed Shah was organized with the initiation of Ibrahimkhalil Khan’s nephew (the son of Ibrahimkhalil’s brother) and Gajar was murdered. After shah’s assassination, the khans of Baku, Ganja and Irevan returned to their cities. The Iranian army quickly retreated to South.
The Karabakh khan’s relative, Mohammed Bey took advantage of it and strengthened his government in the khanate. Vagif was killed with his order. But, after Ibrahimkhalil Khan returned to Shusha, he accused Mohammed Bey Javanshir of betrayal and handed him to Shirvan’s khan Mustafa Khan, a blood-feud enemy. And he executed Mohammed Bey.
After returning to Shusha again, Ibrahimkhalil Khan established friendship ties with Iran’s new shah Fatali Shah and married his daughter to him. Among the women in Fatali Shah’s palace the most beautiful and noble was the daughter of Karabakh’s khan, Beyim Khanoum and she also was the chief harem of the palace. Even the present called “zigiymet”, sent by England’s Queen reached Beyim khanoum and the chief harem in her turn had sent a gratitude letter to the queen with her own signature. Afterwards, Ibrahimkhalil Khan was cruelly martyred by russians and Mehdigulu Khan succeeded to his place.
In the last years of the XVIII century, in complicated internal and international conditions, the Karabakh and Guba khanates sent messengers to Russia to ask for help. The tsar government was attempting to put Azerbaijani khanates under its rule. During the talks with Iran, the Russian government demanded that Iran abandoned Azerbaijan’s Caspian coast provinces and its claims on Georgia.