The Gold Orda khan, Janibey put his son Berdi bey to the throne after the conquest of throne in Azerbaijan and then he returned to Gold Orda. But soon Berdi bey learnt about the death of his father and obliged to leave Azerbaijan. Azerbaijan passed to the hands of Chobanids emirs. Chobanids were in the power only a year.
In 1340, Sheikh Hasan Calairi entirely separated from Hulakids and founded the state of Calairids in Baghdad, but he did not refuse from his demands to Azerbaijan. Although Sheikh Hasan Calairi made campaigns to Azerbaijan in the years of 1340, 1341 and 1344, his goals did not realize. In 1359, the son of Sheikh Hasan Calairi, Sheikh Uveys realized the campaign in order to include Azerbaijan to his state and defeated the Chobanids. After a while he returned to Baghdad. Chobanid emir Akludjuq occupied the throne for a little time in Azerbaijan. In 1359, the governor of Persia, Muhammed Muzaffar Yusuf realized campaign to Azerbaijan and captured Tabriz. But after a week he had to leave the city, because of the information about approach of Sheikh Uveys Calairi to the frontiers of Azerbaijan. Sheikh Uveys entered to Tabriz. Azerbaijan was included to the state of Calairids. The state of Calairids enviloped the territory of Azerbaijan, Arabic Irag, Persian Irag, Georgia and Armenia.
Sheikh Uveys changed the economic and cultural life of the country. There were constructed irregative canals, there was shaped a condition for the development of agriculture as well as were built agricultural settlements in his presence.
But the uprisings against existing authority damaged the economy of the country. During the struggle of ShirvanShah Kavus for independence, there was arisen revolt in Baghdad in 1364. Sheikh Uveys pressed the revolt in Baghdad. Neverthless, ShirvanShah Kavus, who utilized from this situation entered to Karabakh and resettled a part of the population in Shirvan. That’s why, Sheikh Uveys captured Shirvan in 1367. After three monthes of prisoner, Kavus again became the governor of Shirvan.
The state of Calairids, with the capital in Tabriz, possessed original place in the statehood of Azerbaijan.
After the death of Sheikh Uveys, his son Sultan Hussein (1374- 1382) came to the throne. In his presence, there was intensified feudal strife in the country. Shah Shuca in Shiraz and Gara Muhammed Karakoyunlu in Diyarbekir did not want to recognize the authority of Calairids. In 1376, Shah Shuca captured Tabriz. But after a while, in 1377 Sultan Hussein was able to liberate the city. There was made a decision to realize campaign against Bayram Khoca and Gara Muhammed Karakoyunlu in the assembly in the city of Uchan. Sultan Hussein managed to subordinate them. In 1378, Baghdad emirs attacked to the Sultan’s residence in Uchan with 10 thousandth troops.
But Sultan Hussein defeated them. In 1381, Shah Shuca again attacked to Tabriz, but was not able to conquer the city and returned to Shiraz.
The brother of Sultan Hussein, Sultan Ahmed, who utilized from the disagreement of settled people and local feudals, gathered troops in Mugham and Arran, entered to Tabriz, murdered his brother and occupied the throne. Sultan Ahmed was the ruler of the state of Calairids in 1382-1410 (with breaks).
But, there weren’t happened essential changes in the country. The brother of ruler, Sultan Beyazid escaped from Tabriz to the governor of Sultaniyye, emir Adil and proclaimed him the Sultan. As Sultan Ahmed did not have power for resistance, he went to Nakhichevan. But, because of that line of emirs continued to be in the side of Sultan Ahmed, emir Adil had to leave Tabriz. Baghdad troops entered to Azerbaijan with other brother of the ruler, Bayazid Sheikh Ali and Ali Barek. Sultan Ahmed firstly decided to move to the city of Uchan, but then he did not rely on his emirs and came to Nakhichevan, concluded an alliance with Garab Muhammed there. The allies attacked to Baghdad emirs, Sheikh Ali and Barek were killed, Arabic Irag was subordinated to Sultan Ahmed. Sultan Ahmed returned to Tabriz. At that time, emir Sultan and Sultan Beyazid again began to the campaign against Sultan Ahmed. Sultan Ahmed, who retreated to Shirvan, concluded alliance with ShirvanShah Kavus. The enemies encountered in Mugham, but by the initiative of ShirvanShah, the brother came to the agreement that Sultan Ahmed would own Azerbaijan (in the South from Kura) and Sultan Beyazid-Persian Irag. Arabic Irag was divided into two parts, which were ruled by governors. But emir Adil, who dissatisfied from the last arrangement, sent his emirs to Baghdad and began to rule the city through them. Sultan Ahmed withdrew emir Adil from Baghdad and returned to Tabriz. The battle between the troops of Sultan Ahmed and emir Adil took place in the area of Leylan, near Maragha. None of the sides could won in this battle. Emir Adil returned to Sultaniyye and Sultan Ahmed came back to Maragha. Due to new campaign against Sultan Ahmed, emir Adil concluded alliance with Shah Shuca from Muzaffarid dynasty. But Sultan Ahmed managed to prevent this campaign and attracted to bring Shah Shuca to his side, Sultaniyye passed to Beyazid, but Sultan Ahmed utilized from the disagreement of people, entered to the city and returned the authority of city. In 1384, the whole state of Calairids became under the reign of Sultan Ahmed.
But the happiness of Sultan Ahmed did not last long. In 1370, there was established the state of Teymurids in the Central Asia. Due to enlarge the territory of his state, Teymur decided to conquer several countries, as well as Azerbaijan. On the other side the Gold Orda khan Tokhtamush also aimed to capture Azerbaijan. At the result of foreign invasions Azerbaijan left the state of Calairids and in various periods this country was under the reign of Teymur’s governors, local feudals and the dynasty of Karakoyunlu. Although Sultan Ahmed attemped to restore his reign over Azerbaijan, he was not able to do it.
The weakening of Calairids as well as absence of Sultan Ahmed in Tabriz caused to the increasement of foreign invasions. The invasions of emir Teymur and Tokhtamush intensified in 70-80s of the 15th century. Emir Teymur, who established large empire sent obliging letters to neighnourhood countries and ordered them to obey. The governor of Khorasan, Shahveli called them to unite against Teymur, but these messages were unresulted. So, Teymur conquered Khorasan and then moved against Sultan Ahmed. The troops that were sent by Sultan Ahmed against Teymur were defeated. Teymur, who occupied the city of Sultaniyye and had to return to Samarkand because of the events in the Central Asia.
Tokhtamush, who utilized from suitable circumstances entered to Azerbaijan passing through Derbend with 90 thousandth army in 1385; he passed through Shirvan and directed to Tabriz. The settlers of besieged Tabriz began the national resistance. Tokhtamush, who could not break the defence of the city agreed to retreat instead of the brought of kharac with the amount of 250 tumans gold. The settlers of the city put their guns down and began to collect the demanded amount. Tokhtamush utilized from this situation, conquered the city, plundered it and killed the civil people. Sultan Ahmed approached to Tabriz, but Tokhtamush did not let him enter to the city. Enemies conquered Maragha and plundered it as Tabriz. Then the army of Gold orda were divided into two parts; one of them directed to Marand and Nakhichevan, the other- to the direction of Ahar. The troops of Tokhtamush, which destroyed everything on his ways, moved to Karabakh. The troops of enemy, which united there returned to Gold Orda with big amount of trophies and 200 thousand captives.
In the spring of 1386, the army of Teymur moved to Iran and South Caucasus. This campaign was known as “Three-year campaign”.
First of all, Teymur decided to unite with emirs, who were against Sultan Ahmed. Sultan Ahmed, who escaped the battle with Teymur sent part of his forces to Nakhichevan – to the fortress of Alinca, the other – to Baghdad. Tabriz became in the hands of emir Adil. The troops, sent by Sultan Ahmed to Tabriz were defeated and had to retreat. But when emir Adil directed to Teymur Sultan Ahmed entered to Tabriz. Teymur occupied Ucan together with Adil. Sultan Ahmed retreated to Nakhichevan, but did not stay there and moved to Baghdad. Teymur entered to Tabriz, then directed to Nakhichevan and after continuable fought went to Karabakh for winter.
During Teymur’s campaign to Karabakh, another feudal ruler- ShirvanShah Ibrahim I came to his camp with valuable presents, declared his dependence and asked Teymur to conclude an alliance with him. This close relationship caused to the enlargement of north – eastern frontiers of the Teymurid Empire till the river of Debed. Historian Shafaaddin Ali Yezid wrote that Teymur’s sojourn in Azerbaijan assisted Tokhtamush to make campaign to Bukhara and Samarkand. At the result of this event Teymur had to leave Azerbaijan and he gave the control of Tabriz to emir Muhammed Devati and Gara Bastam under the leadership of MiranShah, the control of Sultaniyye – to Akhi IranShah, the control of Maragha – to Shah Ali and the governance of Pishkin – to emir Shabli and Haji Ahmed. After that Teymur left Azerbaijan, there began struggle for the authority both among local feudal and governors of Teymurids dynasty. The supporters of Sultan Ahmed, Mahmud Khalkali, Qara Yusif and troops of the governor of Maragha, Yadigar Shah also included to his struggle.
In 1387, Tabriz passed to the hands of Gara Bastam and emir Shabli. They defeated Muhammed Devati together.
In Feburary, 1387 the kutvali of the fortress of Alinca, Khaca Covhar sent Calairid emir, Altun to Tabriz. Shabli rose against him in Marand, but he was defeated. Tabriz and Maragha were destroyed.
Emir Dovletyar, who was the naib of Shabli governed in Tabriz.
Muhammed Devati inclined Gara Muhammed Karakoyunlu to attack to Tabriz. On May, 25, 1387 the troops of Karakoyunlu entered to Tabriz, arrested Shah Ali and pursued Shabli. In the battle near Khashtrud, Karakoyunlu troops won. But the invasion of Aghkoyunlu troops was the reason of their leaving Tabriz as well as passing its control to Gara Bastam and Emir Calairi. The city passed to entire authority of Sheikh Adil. He called the Kutvali of the fortress of Alinca, Covhar to Tabriz. The governor of Khalkal, Mahmud, who disagreed with current situation attacked to Tabriz and captured it. During five monthes feudal groups (Sheikh Haji, Satilmish, Melik Nizameddin, Khaliq and other) governed Tabriz. Then Altun from Alinca attacked to the city. In 1391, emir Altun prevented the attacks of Mahmud Khalkali and won in the fight. After six-month sojourn in Tabriz, he put there emir Melik Nizameddin and returned to Khalkal. After that Qara Yusif made campaign from Khoy to Tabriz and captured the city. Emir Altun from Alinca attacked to Tabriz and occupied the city. Then he put there his governor and returned to Alinca. At the result of 12-days fought Mahmud Khalkali overwhelmed Altun, entered to Tabriz but was not able to strengthen there. In 1392, Qara Yusif , who moved from the Alatag mountain, captured Tabriz and Mahmud Khalkali escaped. But, after several days Qara Yusif had to leave the city and Tabriz passed to the hands of emir Bastam and his brother Mansur.
The circumstances in Maragha was also strained. Emir Muhammed was in the fortress of Ruindej and the city was ruled by Yadigar Shah. He unsuccessfully attempted to capture Tabriz too.
Bastam Cagiri stayed in Tabriz for a little time too. Qara Yusif again occupied the city. After a month he put his governor – Satilmesh in Tabriz and left the city. Yadigar Shah, who learnt about it approached to the city. At that time Teymur attacked to Azerbaijan with his troops. The Karakoyunlu left Tabriz and Yadigar Shah returned to Maragha. In 1392, Teymur entered to Tabriz. We should mention that, during the years of 1387-1392 Tabriz was invaded in different times and was passed from hand to hand for 14 times.
The sole stronghold of Calairids was the fortress of Alinca, where were preserved their Treasury. The fortress was controlled by Sultan Tahir, Altun and Galabeyi (head of the fortress) Khaca Covhar. 300 Calairid soldiers resisted to the great army of Teymur in Alinca. Sultan Ahmed refused the letter of emir Teymur. Although Teymur fought with great effort, Alinca was defended well.
After this, Teymur directed to Ganja and destroyed the country; the governor of Sheki, Seydi Ali learnt about the approach of Teymurid troops and escaped from Sheki. After these campaigns of 1393-1394s, Teymur moved to Mughan for winter and from there to Mahmudabad.
In the spring of 1395, Teymur realized an invasion to Gold Orda from Derbend. ShirvanShah Ibrahim I and the governor of Maragha, emir Yadigar also took part in this invasion. Teymur, who overwhelmed Tokhtamush, returned in the spring of 1396 and fortificated the Derbend fortress. ShirvanShah Ibrahim was recognized the governor of Shirvan and the independence of Shirvan was provided.
Teymur who occupied his son MiranShah the governor of the territory from Derbend to Baghdad, from Hamadan to Rum and who returned from Azerbaijan made a campaign to India.
After Teymur’s leaving the feudal strife in Azerbaijan intensified, the governors of Sheki and Georgia joint to the defenders of Alinca.
MiranShah oppressed the population in the South of Azerbaijan. People called him “MaranShah” (“the tsar of snakes”). Teymur, who came back from India realized his third campaign to Azerbaijan in 1399. This campaign was known as “seven-year campaign”. He moved from Karabakh to Georgia. Here, by the initiative of ShirvanShah Ibrahim I, several feudal governors, also the son of the governor of Sheki, Seydi Ali-Seyid Ahmed and Georgian tsar, Georgy declared their subordination to the Teymurid Empire. At that time, there occurred conflicts among the feudals in Alinca. The feudals left the fortress with their forces of 12 year of defence (with breaks) and Alinca was captured by Teymurid troops.
Teymur returned to Samarkand and in 1405 he died. At that time the son of MiranShah-Omar Mirza and Shirvan-by Ibrahim I governed Azerbaijan. After the death of Teymur, the feudal internecine intensified in his empire and there began struggle for the throne. Omar Mirza attempted to become independent ruler after the death of his grandfather. ShirvanShah Ibrahim I also utilized from the death of Teymur; Teymurids recognized the independence of Shirvan.
Sultan Ahmed and Qara Yusif , who escaped to Egypt because of Teymur, came back. ShirvanShah Ibrahim I, the governor of Ardebil, Bestam Cairi, the governor of Sheki, Seydi Ahmed and the governor of Ganja, emir Karaman united for the fight against Omar Mirza.
After this, the control over Azerbaijan temporarily passed to the brother of Omar Mirza-Abu Bakr. The people could not bear the oppression of Abu Bakr. There began anti-teymurid uprisings in Tabriz. Sultan Ahmed returned and captured Tabriz in 1406 and restored the state of Calairids. But Ahmed also gained the hate of the nation. So, Abu Bakr again returned to Tabriz and Sultan Ahmed retreated to Baghdad.
ShirvanShah Ibrahim I, who aimed to unite Azerbaijan under the sole power, came to Tabriz but had to leave the city, when he learnt about the approach of Sultan Ahmed and Qara Yusif to the city. On October 14, 1406 Gara Yusuf defeated Abu-Bakr in the battle, on the shore of Aras, in the west of Nakhichevan. And on April 21, 1408 Qara Yusif overwhelmed the troops of MiranShah in the battle near the area of Sardrud, located in the south of Tabriz. MiranShah was murdered in the battle, Qara Yusif subordinated Shirvan and Sheki.
There occurred battle between Sultan Ahmed Calairi and Qara Yusif Karagoyunlu in the village of Asad, next to Tabriz on August 30, 1410. After the victory in this battle, Qara Yusif obliged Sultan Ahmed to sign order, which legalized the passing of the governance of Azerbaijan to the representative of new dynasty, namely to Pirbudaq (Qara Yusif ’s son), who was adobted as a son by Sultan Ahmed. In the next day, Sultan Ahmed was assosinated by the order of Gara Yusuf. The dynasty of Calairids (1358-1410) ended. Azerbaijan was included to the new state of Karakoyunlu (1410-1467).