High Middle Ages in Azerbaijan

The High Middle Ages, or Classic Feudalism Period in what constitutes the present-day Republic of Azerbaijan, lasted from around the 11th century to the 15th century AD. The High Middle Ages were preceded by the Early Middle Ages and were followed by the Late Middle Ages, which ended around the 15thcentury AD. Key historical trends of the High Middle Ages include the incorporation of the territories that constitute present-day Azerbaijan into the Seljuk Empire, the establishment of the Eldiguzids, the Mongol invasions and the rule of the Ilkhanate, the invasions of Timur and the establishment of the Turkoman Kara Koyunlu and Aq Qoyunlu tribal confederations.

Seljuk dynasty
In the 11th century, the Seljuk dynasty of the Oghuz Turkic origin, which emerged in Central Asia, crossed the Araz River while marching to Gilan and then reached Arran. In 1048, the Seljuk dynasty, together with the Azerbaijani feudal lords, defeated the Christian bloc (Byzantine and Christian states of the South Caucasus). When the Seljuk ruler Toghrul Beg came to Azerbaijan and Arran to assert his authority, Rawwadid ruler Vahsudan in 1054, and then in 1062 his son and successor Mamlan II was forced to accept the rule of Toghrul Beg in Tebriz. After Rawwadid Vahsudan, Togrul Bey came to Ganja and Abulasvar Shavur accepted his rule in 1054.

After the death of Toghrul, Alp Arslan and his vizier Nizam ul-Mulk visited Ganja during the reign of Fazl Muhammad II, who came to power after Abulasvar Shavur. In return for Alp Arslan's promised expedition to the Alans, he demands 1,000 camels, 50 horses, finely decorated robes, and a mysterious “garden” (bostān) that had trees of gold and blossoms of precious stones weighing 100,000 meṯqāls, however, the march does not take place because of winter.In 1075, Alp Arslan annexed the last of the Shaddadid territories. A cadet branch of Shaddadids continued to rule in Ani and Tbilisi as vassals of the Seljuq Empire until 1175 when Malik-Shah I deposed Fadl III. In 1085, Fadl III instigated a revolt and gained possession of Ganja. Malik-Shah launched a campaign in 1086 and removed Fadl from power again. A collateral line of Shaddadids, through Manuchihr, continued to rule in Ani.

Referring to the work of Minorsky, Azerbaijani historian Sara Ashurbeyli states that in 1066–067, during the reign of Shah Fariborz b. Sallār (1063–1096), ruler of Shirvanshahs,  Seljuk Turks headed by commander Qarategin made great marches to Shamakhi and Baku, and then Shah I Fariburz accepted to be dependent on the Seljuks by paying 40,000 dinars a year.

It is clear from the coins minted by Manuchohr II (1096–1106), who came to power after Shah I, in the name of Mahmud, the Seljuk sultan of Iraq, that the Shirvanshahs were dependent on the Iraqi Seljuks at that time.

In 1117, Demetrius I was sent by David IV of Georgia at the head of the Georgian army to Shirvan, where Demetrius took down the Agdash fortress. In 1120, David entered Shirvan and took the city of Qabala. During this time, the Shirvanshahs had a power shift between the rising Georgian and Seljuk states.

During the reign of Shirvanshah III Manuchehr (1120–1160), the Shirvanshah state gave up paying 40,000 dinars a year to the Seljuk Empire, and in return, Sultan Mahmud attacked Shirvan in 1123.

However, Sultan Mahmud retreated in front of the combined troops of the Shirvanshahs, Kipchak Turks and David IV. In 1123–1124, David IV invaded Azerbaijan and captured the fortresses of Gulustan and Bugurd, but after David's death in 1125, his army was forced to leave Shirvan. During the reign of Demeter I, there was no military conflict with the Shirvanshahs.

Coins from the reign of Manuchohr III also show that the state of the Shirvanshahs at that time depended on the Iraqi Seljuk sultan Malik Shah.

In 1160, after the death of Manuchehr III, Tamar joined the power struggle between her sons and tried to unite Shirvan with Georgia with the help of Kipchak mercenaries. Manuchehr's older son, Akhsitan I (1160–1197), won the battle for the throne, forcing Tamar and his younger brother to flee to Georgia with the support of the Eldeniz dynasty.

The absence of the sultan's name on the coins minted during the reign of his son Akhsitan I indicates that the Seljuk state was already weakened and the Shirvanshahs were independent.

Management
During the Seljuk rule, emirs were given "igta" lands in exchange for military service. It was one of the lands given by the sultans in Aran, Shirvan and Derbent as "igta". Various taxes were collected from the population, such as ushr (Usura), jizya and tribute taxes, as well as the expense of gun, and the expense of wine.

The meaning of the word
Atabeg, Atabek, or Atabey is a heritable title of nobility of Turkic Origin indicating a governor of a nation or province, who was subordinate to a monarch and charged with raising the crown prince.It is a combination of two Turkish words – “ata”-father and “bey”-lord, leader.They were known as “Great Atabaks” (atābakān-e aʿẓam) of Sultan of Iraqi Seljuks and controlled the sultans from 1160 to 1181.

Shams ad-Din Eldiguz (1136-1175)
According to Minorsky, the Sultan of Iraqi Seljuks, Ghiyath ad-Din Mas'ud, gave Seljuq province of Arran (amongst others) to Kipchak slave Shamseddin Eldeniz (Eldiguz) as iqta in 1137. Eldegiz chose Barda as his residence, and attracted the local emirs to his camp.

The state's power base was centered around Nakhchivan and would focus on Georgia. It expanded to Arran and took control of from Baylagan to Shamkir. He made himself virtually independent ruler of what is the modern-day Republic of Azerbaijan by 1146. His marriage to the Mumine Khatun enabled him to intervene in the dynasty dispute between the Seljuk sultans of Iraq, which began after Masud's death in 1152. Eldiguz, in alliance with Ahmadili atabeg (Ahmadilis) Arslan Aba, waged war against Sultan Muhammad II and maintained this alliance until 1156.

Eldeniz had married the widow of the Seljuq ruler Toghrïl II and proclaimed Great Atabeg (guardian) of his stepson, Arslanshah in 1161 and became the main protector of the Sultan's government. He obtained Arran amongst others, and turned numerous local rulers into his vassals.

Eldeniz appointed his eldest son Muhammad Jahan Pahlavan as the sultan's emir-hajib and his second son Gizil Arslan as the supreme commander of the sultan's army.

In 1161, during the reign of King George, Georgian troops captured the city of Ani ruled by Shaddadids, and then attacked the city of Ganja in the territory of Arran. In 1163, Eldeniz defeated Georgian troops and Shaddadids became a vassal of Eldeniz about 10 years. Campaigns against Georgians continued in 1174–1175. After the death of Shamsaddin Eldaniz in Nakhchivan in 1175, his son Muhammad Jahan Pahlavan succeeded him.

Muhammad Jahan Pahlavan (1175-1186)
Pahlavan transferred the capital from Nakhchivan to Hamadan in western Iran and made his younger brother, Qizil Arslan Uthman, the ruler of the political entity. In 1174, Qizil Arslan captured Tabriz, which subsequently became his capital.

Arslanshah marched to Azerbaijan (Iranian Azerbaijan) together with the emirs against the Eldaniz government, but Muhammad Jahan Pahlavan eliminated his rival and replaced him with his son Togrul III and proclaimed himself as Toghrul's atabeg.

According to Ravandi, during the ten years of Atabeg Jahan Pahlavan's rule, the state was not subjected to any foreign aggression. “During his rule, Georgians made peace with him and accepted his demands”. After a while, Atabeg established friendly relations with Khwarazm Shah Tekish (1172–1200). During his reign, Caliph al-Mustadi and Caliph al-Nasir were unable to interfere in the internal affairs of the state.

Muhammad Jahan Pahlavan entrusted the management of Arran to his son Nusrat al-Din Abu Bakr and made Qizil Arslan his governor.

Qizil Arslan (1186-1191)
After Muhammad Jahan Pahlavan's death, his brother Qizil Arslan (1186–1191) ascended the throne. He continued his successful struggle against the Seljuq rulers. At the same time, the central power began to get weaker as mamluks, who had strengthened their dominance in their areas, did not want to obey the Sultan. Even Shirvanshah Akhsitan I who used to be Atabegs’ liegeman attempted to intervene the interior affairs of the Eldiguzids and opposed Qizil Arslans aspiration to the throne. In the response to this, Qizil Arslan invaded Shirvan in 1191, reached to Derbent and subordinated the whole Shirvan to his authority. In 1191 Toghrul III, the last Seljuq ruler was overthrown by Qizil Arslan. Then, by Khalif’s leave, he proclaimed himself a Sultan,married Innach Khatun, his brother’s widow, and then he was poisoned by Innach Khatun in September, 1191.

The collapse of the state
After the death of Qizil Arslan, the power was divided among Jahan Pahlavan’s sons, however, soon they started to fight for the throne. Abu Bakr came to the fortress of Alinja. The fortress, along with all the treasures, was at the disposal of Jahan Pahlavan's other widow, Zahida Khatun. Abu Bakr captures the fortress and the treasury. Qizil Arslan’s nephews began to rule independently, and one of the Mamluks of Jahan Pahlavan, Mahmud Anas Oglu,freed Toghrul III from his prison and regains the sultanate throne in May 1192. However, soon after, in 1194, after a long war with theKhwarazm Shahs, Sultan Togrul III was defeated and the existence of the Iraqi Seljuk Sultanate came to an end.

After defeated by Abu Bakr, Amir Amiran Omar went to gain a support from Shirvanshah Akhsitan I and Georgian Tsarina Tamar. In 1994, the united Georgian-Shirvan and Amir Amiran Omar’s troops defeated Abu Bakr in the battles of Shamkir and Beylagan. Later, the Georgians trying to capture Ganja, temporarily occupied it, but soon Abu Bakr’s troops drove the Georgians out of Ganja. After the death of Abu Bakr, Muzaffar al-Din Uzbek came to power. He was the fifth and last ruler of the Eldiguzids from 1210 to 1225. During his reign, the country was attacked by Mongols and Georgians. In 1225, Khwarazm Shah Jalal-ad-din dethroned the Ildegizid Uzbek Muzaffar al-Din and set himself up in the capital of Tabriz on the 25 of July in 1225.

Architecture
Ajami Abubakr oglu Nakhchivani is one of the architects who lived and created in Azerbaijan during the Atabegs of Azerbaijan. Ajami, also known as “Sheikh al-Muhandis”, was the architect of the several famous architectural monumentssuch as Yusif ibn Kuseyir Mausoleum, Momine Khatun Mausoleum and Juma Mosque and the founder of the Nakhichivan School of architecture. The mausoleums of Nakhichivan was nominated for the List of World Heritage Sites, UNESCO in 1998.

The Mausoleum of Yusif ibn Kuseyir was built in 1161–1162 and was decorated with geometric patterns of baked brick in Karabaglar village of Nakchivan city,the capital of the Atabegs state.

Momine Khatun Mausoleum was built in the west part of Nakhchivan in 1186. Mausoleum was erected on the grave of Shams ad-Din Eldiguz’s wife Momine Khatun, and its construction was finished by Mahammad Jahan Pahlavan. It is the only monumentthat has survived. There are four circular medallions on the perpendicular arrows (diameter 1.5 m) in the interior of the dome's brick rows. The ornaments made of the mix of gypsum and clay, consist of Kufi-style compositions. The essence of all the compositions is the word "Allah". Omar, Osman, Ali words intersect with each other, forming 6, 8 and 10 pointed stars and surround the word “Allah”.

Gulistan Mausoleum, built of red sandstone near Julfa. This building is 12-sided and covered with rich and intricate, but delicate geometric ornaments. The Gulustan mausoleum is one of the remarkable architectural monuments of the early 13th century, which demonstrates the genetic commonality of the tombs in Azerbaijan and Anatolia.

Literature
Khagani (1120–1199), one of the poets born in the cities of Azerbaijan in the XII century, lived in Shirvan, in the palace of Shirvanshahs and composed a Divan consist of qasidas. He had moved from Shamakhi to Tabriz, became acquainted with Qizil Arslan and composed poems appreciating the latter.

Nizami Ganjavi (1141–1209) born in Ganja, wrote works dedicated to the Seljuk, Atabegs and Shirvanshah rulers. Nizami's main poetical work, for which he is best known, is a set of five long narrative poems known as the Khamsa or Panj Ganj. Makhzan-ol-Asrâr (The Treasury or Storehouse of Mysteries, 1163) was dedicated to Fakhr al-Din Bahramshah, the ruler of Erzinjan; Khosrow o Shirin (Khosrow and Shirin, 1177–1180) was dedicated to the Seljuk Sultan Toghril II, the Atabek Muhammad ibn Eldiguz Jahan Pahlavan and his brother Qizil Arslan. Nezami composed his romance Leyli o Majnun (Layla and Majnun, 1192) at the request of the Shirvanshah Akhsatan. Eskandar-Nâmeh (The Book of Alexander, 1196–1202) was dedicated to Nusrat al-Din Abu Bakr ibn Muhammad,  Atabegs of Azerbaijan, and Malik Izzaddin, the ruler of Mosul. Haft Peykar (The Seven Beauties 1197) was dedicated to Aladdin Korpe Arslan, the ruler of Maragha from the Ahmadilis dynasty.

Mahsati Ganjavi, born in Ganja (1089–1159), was a composer of philosophical and love quatrains (rubaiyat), glorifying the joy of living and the fullness of love. The most complete collection of her quatrains are founded in the Nozhat al-Majales. Approximately 60 quatrains of her are found in the Nozhat al-Majales.

Mongol invasions of Azerbaijan
The Mongol invasions and conquests of Azerbaijan took place during the 13th and 14th centuries and involved large-scale raids. The Mongol invasions of Azerbaijan resulted in the incorporation of the territories of Azerbaijan into the newly established Hulagu state.

During the first invasion of Azerbaijan by the Mongols in 1220–1223, cities such as Bailagan, Barda, Ganja, which were the territory of the Atabegs of Azerbaijan, were destroyed. At that time, there was a political disintegration in the state of Atabegs of Azerbaijan. After the defeat of the Empire of Khorezmshahs, the 20,000 Mongolian expeditionary corps led by the military commanders Jebe and Subutay in the persecution of the last Khorezmshah conquered Iran and attacked the territories that nowadays comprise Azerbaijan in 1220. The Mongols invaded from Nakhichevan, driving Atabeg Uzbek from Ganja in Azerbaijan to Tabriz. The Mongols, who entered the territory of Azerbaijan, spent the winter in the Mughan steppe.

After Mongolians defeated some 10,000 Georgians commanded by King George IV "Lasha" of Georgia in the fall of 1220, they returned to Arran. They spent the winter in the Mughan steppe and kept their captured treasures in the swampy area between Barda and Beylagan. Thinking that the Mongols would stay in Arran until the Spring, the Georgians began gathering an army, asking for help from Malik Ashraf of Akhlat and Uzbek, the Atabag of Azerbaijan. Subotai and Jebe received reinforcements from Genghis Khan and recruited local Turkish and Kurdish forces under the command of Akush, a disloyal underling of Atabag Uzbek. Subutai and Jebe then marched towards Tbilisi. Close to Tbilisi the Mongols attacked a Georgian force. The Georgians managed to defeat Akush's Turkmen but were slaughtered by the Mongol rearguard.

Eventually, the Mongols marched to the north, plundering the Shirvan route. In addition, Beylagan was plundered in the spring of 1221. This took them through the Caucasus into Alania and the South Russian steppes where the Mongols routed the Rus’-Kipchak armies at the Battle of the Kalka River (1223). Ibn al-Athir described the Mongol invasions of Azerbaijan as follows:

The second invasion of the Mongolians to Azerbaijan is connected with the name of Chormagan Noyon- a military commander of Genghis Khan in the 1230s. Khwarazmshah retreated to Ganja. The Mongols followed him and captured Arran. Jalal ad-Din took refuge in the Mayyafarikin mountains and there in August of that year he was killed.

Mongolians entered the Mugan Plain in 1233. In 1234, they moved forward to the Araxes River toward Ganja, and in 1235, they captured Ganja and burnt down the city.

During 1244–1255, Arghun Agha was nominated as a civil governor and head of finances in the Mongol-controlled area of Khorasan, Irak-Ajem, Azerbaijan, Shirvan, Kerman, Georgia, and that part of Hindistan.

In 1254, the Mongols registered all men over the age of ten and insisted on paying all taxes. All artisans were forced to pay a license tax, and lakes and ponds where they fished, iron mines, and blacksmiths were taxed. They also obtained gold, silver, and precious stones from the merchants.

The third invasion of territories of Azerbaijan by Mongolians is associated with the name of Hulagu khan. After his brother Möngke's accession as Great Khan in 1251, Hulagu was appointed as administrator of North China, however in the following year, North China was assigned to Kublai and Hulagu tasked with conquering the Abbasid Caliphate. He was given a fifth of the entire Mongol army for the campaign, who were accompanied by families and herds. According to Rašid- al-Din, it was not just a military campaign but also the mass migration of a large portion of the Mongolian people to Persia and the neighboring countries.

He destroyed the Nizari Ismaili state and the Abbasid Caliphate in 1256 and 1258 respectively. In 1258, Hulagu proclaimed himself Ilkhan (subordinate khan). The state established in the areas of modern Iran, Azerbaijan, Turkey, and parts of modern Iraq, Syria, Armenia, Georgia, Afghanistan, Turkmenistan, Pakistan, was an attempt to repair of the damage of the previous Mongol invasions.

Thus, the territories of Azerbaijan became a battleground between the Golden Horde and the Hulagu states.

After the death of Keykhatu khan, Ghazan khan (1295–1304) began to fight with Baydu khan and captured him near Nakhchivan.

Ghazan Khan settled on the Ilkhanid throne in Karabagh in November 1295. According to Rashid ad-Din, “all the court ladies (khavatin), princes, warlords (umara), pillars of power and court magnates gathered in Karabagh of Arran and without pretense and hypocrisy they agreed to the reign of the sovereign of Islam and gave that commitment”.

In March/April, he nominated his brother Öljaitü as his successor, as he had no son his own.

Abu Sa'id had to face another invasion by Özbeg in 1335 and left to face him, but died on his way in Karabakh, on night of 30 November to 1 December 1335.

In consequence of which, Abu Sa'id died without an heir or an appointed successor, thus leaving the Ilkhanate vulnerable, leading to clashes of the major families, such as the Chupanids, the Jalayirids.

After the death of Abu Sa’id, the Chobanids dynasty ruled over Azerbaijan, Arrān, and parts of Asia Minor, Mesopotamia, and west central Persia from 1335 to 1357, until the death of Malek Ashraf.

In 1364 Shaykh Uways Jalayir campaigned against the Shirvan Shah Kai-Ka’us, but a revolt begun by the governor of Baghdad, Khwaja Mirjan, forced him to return to reassert his authority. In 1366 Shaykh Uways Jalayir marched against the Kara Koyunlu, defeating their leader, Bairam Khwaja, at the battle of Mush. Later, he defeated the Shirvan Shah, who had attacked Tabriz twice in the meantime. According to Zayn al- Dīn Qazvīnī and Ḥāfiẓ Abrū, Kā’ūs readily overpowered all of Shirvan and Darband for Shaykh Uways Jalayir, and remained a faithful servant as long as he lived. After the death of Kā’ūs, Shaykh Uways Jalayir confirmed his son, Hūshang, as the successor of Shirvanshahs.

After the death of Shirvanshah Hushang in 1382, Ibrahim I was selected to be the ruler of Shirvanshahs. In 1386, Ibrahim recognized Timur as his suzerain. Once his grandfathers were rulers of Darband. For that reason, his successors were known as Darbandis (1382–1538). When Timur arrived to Caucasus in 1394, Ibrahim gave him gifts and riches as presents in order to maintain good relations with him. However, one of these gifts were eight slaves, which Timur did not see as enough—when he asked Ibrahim why he had only given eight slaves, Ibrahim replied: “I am myself the ninth”. This made Timur glad, who due to the kindness of Ibrahim gave him much land and promised to protect him.

In the midst of Timur's absence, Sultan Ahmad had to deal with an invasion by Tokhtamysh, Khan of the Golden Horde. At the end of 1385 Tokhtamysh entered from Darband to Shirvan and reached Tabriz. After invasion of Tabriz, Tokhtamysh's troops invaded Maragha, Marand and Nakhchivan, either.

Reign of Kara Koyunlu in Azerbaijan
Kara Koyunlu or Qara Qoyunlu were a Muslim Turkoman monarchy that ruled over the territory comprising present-day Azerbaijan and other parts of Caucasus from about 1375 to 1468.

The Kara Koyunlu Turkomans were initially vassals of the Jalairid Sultanate in Baghdad and Tabriz from about 1375, when the leader of their leading tribe ruled over Mosul. However, they rebelled against the Jalairids, and secured their independence from the dynasty with the conquest of Tabriz by Qara Yusuf. After ending the existence of the Jalairis, they began to rule independently in Azerbaijan.

Timur completed his Indian campaign and returned to Azerbaijan in 1396. Kara Yusuf, who retreated to Mosul to avoid a sudden raid, was able to take shelter in the Ottomans in 1400.

The hosting of Yildirim Bayezid to Kara Yusuf was one of the main reasons Timur launched a campaign against the Ottomans. Although Kara Yusuf wanted to stop the Chagatay people with a little force, he could not succeed. He was able to reach Damascus by escaping into the desert. Kara Yusuf was welcomed by Sheikh Mahmud, the nâib of Damascus. Not long after, Jalairid Sultan Ahmed also came to Damascus. Not wanting to worsen relations with Amir Teymur, Nasir-ad-Din Faraj agreed to capture Gara Yusif and Sultan Ahmed Jalairi, and hand them over to Teymur. Sultan Ahmed Jalayir and Kara Yusuf imprisoned on the order of Nasir-ad-Din Faraj. Together in prison, the two leaders renewed their friendship, making an agreement that Sultan Ahmed Jalayir should keep Baghdad while Qara Yusuf would have Azerbaijan. Ahmad also adopted his son Pirbudag. When Timur died in 1405 Nasir-ad-Din Faraj released them both. However, according to Faruk Sümer, they were released on the orders of rebellious wali of Damascus - Sheykh Mahmud.

Qara Yusuf, having returned from exile in Egypt and went back to Anatolia. He forced Timur's governor in Van Izzaddin Shir to submit, while capturing Altamış, another viceroy set up by Timur and sending him to Barquq. He later moved on to the territories of Azerbaijan. He defeated the Timurid Abu Bakr at the Battle of Nakhchivan on 14 October 1406 and reoccupied Tabriz. Abu Bakr and his father Miran Shah tried to recapture Azerbaijan, but on 20 April 1408, Qara Yusuf inflicted a decisive defeat on them at the Battle of Sardrud in which Miran Shah was killed.

In 1409 fall, Qara Yusuf entered Tabriz and sent a raiding party to Shirvan, especially Shaki, which was fruitless. Kara Koyunlu defeated Jalayirds in 1432, bringing an end to the dynasty.

Further consolidating his rule, Qara Yusuf marched on Shirvan, where Shirvanshah Ibrahim, a loyal Timurid vassal was still reigning. Shirvan's former ally the Karabakh ruler Yar Ahmed Qaramanli sided with Abu Nasr Qara Yusuf, while Ibrahim joined his forces with the ruler of Shaki, Syed Ahmed Orlat and the Georgian king Constantine I, who marched in the head of 2,000 Georgian cavalry to support the Shirvanese allies.

A major battle was fought at the village Chalagan in December 1412 and ended in a decisive defeat of the allies. Ibrahim and Constantine fell at the hands of the fierce enemy. The Georgian king, his brother, and 300 Georgian officers were beheaded by the orders of Abu Nasr Qara Yusuf.

He died on his way to battle Shahrukh (who demanded his submission) on 17 November 1420. After the death of Qara Yusuf in December 1420, Shahrukh Mirza tried to take Azerbaijan from Qara Yusuf's son Qara Iskander, using the fact that none of his sons was accompanying his father. Despite defeating Iskander, twice in 1420–21 and 1429, only in the third expedition of Shahrukh Mirza in 1434–35 did the Timurids succeed, when he entrusted the government to Iskander's own brother, Jahan Shah (1436–1467)  as his vassal. In 1436 he obtained the help of the Timurid ruler Shah Rukh to defeat Qara Iskander and seize the throne for himself. He was also adopted by Goharshad Begum and crowned on 19 April 1438, along taking epithet "Muzaffar al-Din".

Upon the death of the Timurid ruler Shah Rukh in 1447, Jahan Shah became an independent ruler of the Kara Koyunlu, and started to use the titles of sultan and khan. He expanded his ruling territory to Iraq, Fars, Kerman and even Oman.

From around 1447 Jahan Shah was involved in a struggle against the Ak Koyunlu who had always been sworn enemies of the Kara Koyunlu. First of these battles happened when Alvand Mirza rebelled and fled to Jahangir beg, chief of Ak Koyunlu. Jahan Shah demanded his rebellious nephew, but Jahangir refused to hand him over. Jahan Shah invaded Erzincan and sent his commander - Rustem beg to subdue Jahangir. Hopeless Jahangir sent his mother Sara Khatun to Mamluk Egypt while Jahan Shah started to support his half-brother Sheikh Hasan. While Sheikh Hasan was killed by Uzun Hasan, brother of Jahangir; Jahan Shah hasted to offer peace to Ak Koyunlu, in return to accept their submission. Jahangir accepted and also wed his daughter to Mirza Muhammad.

Cihan Shah spent the winter of 1466 in Tabriz. The following year, he invaded Shirvan and obtained the places that reached Derbend. At that time, the lands of the Karakoyunlu State included Azerbaijan, Arran, Irâk-ı Acem, Irâk-ı Arab, Persian, Kirman and Eastern Anatolia. The Georgian king and the rulers of Shirvanshah, Gîlan and Mâzenderan also recognized his sovereignty.

Jahan Shah set out from Tabriz with a great army on 16 May 1466, and came to the basin of Lake Van. While there, he was furious to learn that Uzun Hasan was raiding his lands with 12,000 cavalry. Meanwhile, Uzun Hasan, suspecting that Jahan Shah was planning to attack him, had carefully guarded the mountain passes. Envoys went back and forth between them, but because of Jahan Shah's heavy demands, an agreement could not be reached. Having advanced as far as Muş, Jahan Shah had to postpone his attack because of the onset of winter. As his troops began to complain, he decided to withdraw to a winter residence. Uzun Hasan caught his army by surprise and totally defeated them in a sudden attack. Mirza Yusuf and Mirza Muhammad was captured on 30 October or 11 November 1467 at the Battle of Chapakchur. Jahan Shah was killed in battle while fleeing. and with his death the great era of Kara Koyunlu history came to an end. Jahan Shah had been buried in southern part of Blue Mosque, Tabriz. He was succeeded by his son Hasan Ali. Soon Hasan Ali was killed by Okurlu, Uzun Hassan's son.

Governance
The Qara Qoyunlu state organization was based mainly on of its predecessors, Jalayirids, and the Ilkhanids. Qara Qoyunlu rulers used the title sultan since the enthronement of Pirbudag by Qara Yusuf. Sometimes the title bahadur appeared on the coinage. They also used the titles khan, khagan and padishah.

As for the provincial organization, the provinces were governed by şehzade and beys, who had smaller divans in each of the provinces. The governance by military governors (beys) generally passed on from father to son. In the cities there were officials called darugha, that looked after financial and administrative affairs, and also had political powers.

Culture
Palace of the Shirvanshahs is a historical 15th-century palace built by the Shirvanshahs and described by UNESCO as "one of the pearls of Azerbaijan's architecture". It is located in the Inner City of Baku. The complex contains the main building of the palace (the 1420s), Divankhana (the 1450s), the burial-vaults – (1435), the shah's mosque with a minaret (1441), Seyid Yahya Bakuvi's mausoleum (the 1450s) and the remnants of the Keyguba mosque. It is the biggest monument of the Shirvan-Apsheron branch of the Azerbaijani architecture. Shirvanshah's palace mausoleum is a part of Palace of the Shirvanshahs complex. The mausoleum is one of the three buildings located in courtyard of the complex, the others being Shirvanshah's palace mosque and Shirvanshah's palace bath house.