Early Middle Ages in Azerbaijan

In the history of Azerbaijan, the Early Middle Ages lasted from the 3rd to the 11th century. This period in the territories of today's Azerbaijan Republic began with the incorporation of these territories into the Sasanian Persian Empire in the 3rd century AD. Feudalism took shape in Azerbaijan in the Early Middle Ages. The territories of Caucasian Albania became an arena of wars between the Byzantine Empire and the Sassanid Empire. After the Sassanid Empire was felled by the Arab Caliphate, Albania also weakened and was overthrown in 705 AD by the Abbasid Caliphate under the name of Arran. As the control of the Arab Caliphate over the Caucasus region weakened, independent states began to emerge in the territory of Azerbaijan.

History
In 252-253 AD, Caucasian Albania was conquered and annexed by the Sassanid Empire. It became a vassal state, but retained its monarchy; however the Albanian king had no real power and most civil, religious, and military authority lay with the Sassanid marzban (military governor). After the Sassanids’ victory over the Romans in 260 AD, this victory, and the annexation of Albania, were described in the trilingual inscription of Shapur I at the Ka’be-ye Zartošt at Naqš-e Rostam.

A relative of the Sasanian king Shapur II (309-379), Urnayr came to power in Albania (343-371), and pursued a partially independent foreign policy. Urnayr allied with Shapur II, and according to Ammianus Marcellinus, provided military forces (especially cavalry) to Shapur II's armies in their attacks against the Romans, especially in the siege of Amida (359). This ended in the victory of the Sassanid army and as a result, Artsakh, Marlar (now Nakhichevan), Caspiana and other regions of Albania were returned. He also noted that Albanian cavalry played a determinative role in the siege of Amida, like the Chionites (Xionites). After this victory, Shapur II began to oppress the Christians in Albania.

''“Close by him [Šapur II] on the left went Grumbates, king of the Chionitae, a man of moderate strength, it is true, and with shrivelled limbs, but of a certain greatness of mind and distinguished by the glory of many victories. On the right was the king of the Albani, of equal rank, high in honour”.''

In 371, the battle of Dzirav (also known as the battle of Bagavan) took place between the Romans and Sassanid armies. Albania was the Sassanids' ally in this battle too. The battle resulted in the victory of the Roman army. Urnayr was wounded and Albania was deprived of provinces like Uti, Shakashena (Sakasene), Colt (Albania's western border province) and the in this battle. Albania regained its lost provinces with the treaty signed between Rome and Sasanids in 387. In 450, the Sasanian army was defeated by Christian insurgents against the Persian Zoroastrianism of King Yazdegerd II in a battle near the city of Khalkhal (present Gazakh region) and Albania was freed of Persian garrisons. After the death of Yazdegerd II, an intense fight began for the throne in Iran between Yazdegerd's sons Hormuzd and Peroz. The return to Christianity of Vache II resulted in a war between Persia and Caucasian Albania and Vache II declared his recalcitrancy to the new Sasanian ShahenShah Peroz I. After this distrust, Peroz raised the (Onoqur) Huns to fight the Albanian monarch. They occupied Albania in 462. This fight ended with the abdication of Vache II in 463. Albanian historian, wrote that Albania then remained without a ruler for 30 years. The northern part of Azerbaijan became a marzbanianity of the Sasanian Empire.

According to Kalankatli, almost 30 years later, the monarchy of local rulers was reestablished in Albania by the nephew of Vache -- Vachagan III (487-510). Vachagan Barepaš (the pious) was enthroned by the Sassanid shah Balash (Valarsh) (484-488). Vachagan III restored the concessions of the Albanian tsars, reduced taxes, and granted freedoms to Christians.

Independent state institutions were eliminated in the South Caucasus by Sassanids in 510. Sassanid governors-general began a long period (510-629) of domination in Albania. In the late 6th to early 7th centuries, the territory of Albania became an arena of wars between Sassanid Persia, Byzantium, and the Khazar Khanate, the latter two very often acting as allies against Sassanid Persia. In 628, during the Third Perso-Turkic War, the Khazars invaded Albania, and their leader Ziebel declared himself Lord of Albania, levying a tax on merchants and on the fishermen of the Kura and Araxes rivers "in accordance with the land survey of the kingdom of Persia".

The reign of the Mihranids dynasty (630-705) arrived in Albania in the early 7th century. This dynasty originated from Girdiman province (now the Shamkir-Gazakh region of Azerbaijan) of Albania. Partav (now Barda) was the centre of this dynasty. According to Kalankatli, the initiator of the Mehranids’ dynasty was Mehran (570-590), and the representative was Varaz Grigor (628-642), who took the title “Prince of Albania”.

Partav (Berde) was the capital city of Albania during the reign of Varaz Grigor's son Javanshir (642-681). Javanshir gave his allegiance to the Sassanid shah Yazdegerd III (632-651) in the first period of his reign. He was the head of Albanian army as sparapet and an ally of Yazdegerd III in 636–642. Despite the Arab victory in the battle of Kadissia in 637, Javanshir fought as an ally of the Sassanids. After the fall of the Sassanid Empire by the Arab Caliphate in 651, Javanshir changed his policy and moved to Byzantine emperor's side in 654. Konstantin II took Javanshir under his protection. Javanshir became ruler of Albania thanks to the protection of Byzantium. In 662, Javanshir defeated the Khazars near the Kura River. Three years later in 665, the Khazars again attacked Albania, with greater force, and won. According to the treaty signed between Javanshir and the head of the Khazars, the Albanians agreed to pay tribute every year. In return, the Khazars returned all captives and looted cattle. The Albanian ruler established diplomatic relations with the Caliphate in order to protect his country from invasion via the Caspian Sea. For this purpose, he went to Damascus and met with caliph Muaviya (667, 670). As a result, the caliphate did not touch Albania's autonomy, and at the request of Javanshir, Albania's taxes were reduced by a third. Javanshir was assassinated in 681 by Byzantine feudal lords. After his death, the Khazars attacked and plundered Albania again. Arab troops entered Albania in 705 and took Javanshir's last heir to Damascus and put him to death. Thus the rule of the Mihrani dynasty ended in Albania. Albania's internal independence was abolished. Albania began to be ruled by the Caliph's successor.

Religion
According to local tradition, Christianity entered Caucasian Albania in the 1st century through St. Elisæus of Albania, a disciple of St. Thaddeus of Edessa. The first Christian church in South Caucasus was established in Caucasian Albania by St. Elishe in the village of Kish in the region of Uti, now Sheki district, in north-western Azerbaijan. This church was regarded by Caucasian Albanians as the "mother church", the foundation of institutionalized Christianity in the kingdom. At the beginning of the fourth century, the monophysite Albanian church became a state institution as an apostolic church. In the reign of king Urnayr, who was baptized by St. Gregory, Caucasian Albania officially adopted Christianity and it gradually spread. Moisey Klankatlu wrote that the “strict order of the ShahenShah obliged us to stop worshipping our religion, and accept pagan religion of mags”.

In the mid-5th century, under Vache II, (440-463), nephew of Yazdegerd II, Caucasian Albania recanted Christianity and adopted Zoroastrianism under Persian influence. Christian churches were turned into temples, and Christianity was severely persecuted. After Yazdagerd II died in 457, Vache II recanted Zoroastrianism and returned to Christianity. By extending Christianity to Albania, his goal was to get rid of the Sassanid rule. In 498 under the monarchy of Vachagan III, in the settlement named Aluen (Aghuen) (now the Agdam region of Azerbaijan), an Albanian church council convened to adopt laws further strengthening the position of Christianity in Albania. The council produced me a twenty-one-paragraph codex formalizing and regulating the Church's structure, functions, relationship with the state, and legal status. Vachagan III took an active part in Christianizing Caucasian Albanians and appointing clergy to monasteries throughout his kingdom.

Socio-economic and cultural life
During the Sassanid period, two types of land ownership in Albania were common: hereditary land ownership, dastgerd, and conditional land ownership, khostak. Dastgerd emerged with the collapse of communal land ownership, and was distributed among the ruling class by the state. Khostak was given to feudal vassals. In Albania, community land ownership was also frequent. Free peasants with community land have existed there for a long time. Community peasants paid taxes to the ruler's treasury and performed certain duties.

In the fifth and sixth centuries, the feudal class formed in Albania: this class was described by many different terms, mainly azat and nakharar, and peasants (shinakan). The nakharars weren't taxed. Their main task was military service to the ruler, and at first, they ruled entire provinces or districts. During the reign of Khosrow I (512-514) in Azerbaijan, all men aged 20–50 were taxed, except for priests, scribes, aristocracy, and officers.

In the early medieval ages, there were many defensive fortresses and hurdles in Azerbaijan. Shirvan wall was constructed along the river Gilgil, 23 kilometers to the north of Beshbarmag wall. Beshbarmag wall began at the shore of the Caspian Sea and ran to Babadagh and Gilgilchay. Chiraggala was situated on the top of a mountain in the Guba Forest. Another hurdle was built on the north side of the river Saumur. Fortresses like Torpaggala on the bank of the river Alazan, Govurgala (Aghdam region), Javanshir gala (Ismailli region) and Charabkert gala (Aghdara region) were built during Sassanid rule.

History
Al-Walid sent a group of his men north across the river Aras under Salman ibn Rabiah, and to Nakjavan (Nakhchevan) under Habib b. Maslama. Habib ended up with a treaty calling for tribute and jezya and kharaj taxes from the population of Nakjavan, while the army of Salman moved on Arran and captured Beylagan. Then the Arabs attacked Barda, and faced the resistance of local people. After a while, Barda's population had to conclude a treaty with the Arabs. Salman continued his expedition to the left bank of the river Kura and concluded treaties with the governors of Gabala, Sheki, Shakashēn and Shirvan. In 652, Bāb al-Abwāb (Darband) was conquered by the Arabs. After Darband, Salman continued his campaign through the Kazar Khaganate, but lost the battle and was killed. The caliphate again sent an army to the Caucasus under the leadership of Habib b. Maslama in 655.

During the period of Arab invasions of the Caucasus, Caucasian Albania yielded to Arabs only as vassals.

Khazar-Arab wars
Due to the outbreak of the First Muslim Civil War and priorities on other fronts, the Arabs refrained from another attack on the Khazars until the early 8th century. The Khazars, on their part, only launched a few raids into the Transcaucasian principalities loosely held under Muslim dominion: in a raid into Albania in 661/662, they were defeated by the local prince, but in 683 or 685 (also a time of civil war in the Muslim world), a large-scale raid across Transcaucasia was more successful, capturing much booty and many prisoners.

In 722–723, Khazars attacked the territories of South Caucasus under Arab rule and as an Arabian army led by al-Jarrah al-Hakami was swiftly successful in driving the Khazars back across the Caucasus, and fought their way north along the western coast of the Caspian Sea, recovering Derbent and advancing onto the Khazar capital of Balanjar, capturing the capital of the Khazar khanate and taking prisoners around Gabala. Then al-Jarrah returned to Sheki with booty and many captives and garrisoned his army there.

During the early 730s, the Arabs and Khazars fought over Derbent. As a result, in 732, the city came under Arab control by Maslama ibn Abd al-Malik. The Arabs again defeated Khazars in 737 and Arab forces under Marwan ibn Muhammed moved into the central parts of Khazar Khaganate, passing through “the Gates of the Alans”. Marwan returned the south of the Caucasus after capturing Khazar kagan. Thus, the attempts of Khazars to control the South Caucasus were unsuccessful.

Causes
Internal conflicts within the Umayyads, and intensification of discontent among the people under their control led to a socio-political crisis in the Caliphate. Abbasids taking the throne in the middle of the 8th century did not ease the situation or the life of the population in Arran. Starting from the Abbasid period, only a small part of taxes were paid in kind (as natura, food collected instead of currency) as opposed to the Umayyads, who had collected all taxes as natura.

First rebellions
In 748, a revolt against the Umayyad dynasty took place in Beylagan under the leadership of Musafir ibn Kesir, nicknamed "al-kassab". The inspiration for this uprising was al-Dahhak ibn Qays al-Shebani, the leader of the Kharijites. The local feudal lords Ibban ibn Mansur and Hatib ibn Sadal, who were on the side of the caliphate and defended their own interests, attacked Beylagan. The rebellious inhabitants of Arran captured the fortress of Beylagan and released all the prisoners except the Emir. Inspired by this success, the rebels marched on Barda, crushed the Arab garrison, and assassinated the local governor, Asim ibn Yazid. The punitive army sent by the Umayyads could not repel this revolt. With the change of power in the Caliphate, the Abbasids were able to counterbalance the rebellions against the caliphate. The people of Beylagan were vanquished, and the leaders of the uprisings and Musafir were killed. The locals of Shamkir revolted against the Arabic migrants who settled in the city in 752, but the Abbasids soon put down this revolt as well.

Management policy
Under the Rashiduns and early Umayyads, the administrative system of the late Sassanid period was largely retained. Each quarter of the state was divided into provinces, the provinces into districts, and the districts into sub-districts. Then the caliphate created the Emirate system to manage large areas. During the Abbasid period, the number of emirates increased. Emirates were divided into ‘’mahals ‘’ and ‘’mantagas’’. The person who ruled the emirate was called emir and appointed by the Caliph. The territories of Azerbaijan were first included in the fourth emirate, then in the third.

The Caliphate army initially had only Muslims as regular soldiers. While other territories were conquered under the Caliphate, non-Arab local people who converted to Islam were allowed to join the army. Eventually non-Muslims, who were called Dhimmis, were also allowed to join the army and exempted from paying ‘’jizya’’. In addition, the Arabs relocated tens of thousands of Arab families from Basra, Kufa, Syria and Arabia to Azerbaijan in order to create a more reliable social base for themselves and to Arabize the population.

Taxes under the Arab conquest in the territories of Azerbaijan were divided into jizya, kharaj, khums. Jizya was a financial charge on permanent non-Muslim subjects (dhimmis), kharaj a tax on agricultural land and its crops. Sometimes a dhimmi was exempted from jizya if he rendered some valuable services to the state. Khums was taken as a fifth of movable property and fertile lands. The Muslim population also paid zakat, a form of alms-giving treated in Islam as a religious obligation or tax. Zakat (charity tax) was levied on livestock, plant and fruit products, gold and silver, and handicrafts. Zakat was spent on the needs of the clergy, orphans and the disabled. Absheron oil sources and salt lakes were also taxed.

Economic life
The previously slow-growing rice industry began to grow rapidly and began to play a more important role in the economic life of Azerbaijan. In the ninth and tenth centuries, rice cultivation was widespread in the Shabran, Shirvan, Sheki and Lankaran regions. Cultivation of flax and cotton were common in Azerbaijan at that time. Irrigation of Mughan, Mil and other plains created special conditions to increase of cotton growing.

The development of trade created conditions for the rapid development of camel breeding. In the Middle Ages, dromedary and two-humped camels were used in Azerbaijan. Camels were also widespread in the mountainous regions of Azerbaijan, where a semi-nomadic form of livestock herding predominated.

Cities
In the ninth century, weaving became a highly developed field in Azerbaijani cities. Al-Istakhri and Hudud al-Alam in the tenth century said that there was no city equal to Barda, which planted many trees and produced much silk. Among the other regions of Arran, silkworm breeding also developed in Shabran and Shirvan.

At that time Barda, known as the "Mother of Arran" and the residence of the caliphate's rulers, was the largest place not only in Azerbaijan, but in the entire Caucasus. Barda's “Kurki” bazaar” was one of the most popular bazaars in the Middle East.

Gandja was one of the biggest cities of Azerbaijan under the Caliphate. Local artisans made clothes, carpets, wooden utensils of khalandj (iron tree) for the interior and foreign markets of Nakhchivan. The cities of Shirvan and Shamakhi were famous for their silk products. Silk and silk clothes were exported to other cities in the Caucasus and the Middle East.

Feudal states in 9th-11th centuries
As a result of the weakening of the military-political power of the Arab caliphate, and the growing tendency to disobey the central government, some provinces seceded from the Caliphate in the ninth and-tenth centuries. Feudal states such as Shirvanshahs, Shaddadids, Sallarids and Sajids emerged in the territory of Azerbaijan.

Shirvanshahs
From 861 to 1538 the Islamic Shirvanshah dynasty ruled Shirvan and eventually the shores of the Caspian Sea from Derbent to the Kura River. According to Ibn Khordadbeh, the title of “Shirvanshah” referred to the local rulers of Servan (Shirvan), who received their titles from the first Sassanid emperor, Ardashir I.

From the late eighth century, Shirvan was under the rule of the Arab family of Yazid ibn Mazyad al-Shaybani (d. 801), who was named governor of the region by the Abbasid caliph Harun al-Rashid. His descendants, the Yazidids, ruled Shirvan as independent princes until the 14th century. By origin, the Yazidids were Arabs of the Shayban tribe, high ranking generals and governors of the Abbasid army. In the turmoil surrounding the Abbasid Caliphate after the death of the Caliph Al-Mutawakkil in 861, the grandson of Yazid ibn Mazyad al-Shaybani, Haytham ibn Khalid, declared himself independent and accepted the ancient title of Shirvanshah. The dynasty continuously ruled the area of Shirvan either as an independent state or a vassal state until Safavid times.

Vladimir Minorsky, in his book titled "A History of Sharvan and Darband in the 10th–11th Centuries", distinguishes four dynasties of Shirvanshahs:
 * 1) The Shirvanshahs — the Sassanids designated them for the protection of northern frontier;
 * 2) Mazyadids,
 * 3) Kasranids
 * 4) Derbent Shirvanshahs or Derbent dynasty.

According to al-Masudi, in 917, Russian merchants attacked Shirvan and the Caspian provinces from the Don River with 500 ships. The Shirvan ruler Ali ibn Haysam lacked a fleet, so Russian merchants looted the area, and he was dethroned. According to the anonymous work, Hudud al-Alam, the Shirvanshahs united the Layman in 917. Then Shirvanshah Abu Tahir Yazid (917-948) restored Shamakhi (Yazidiyya) in 918 and moved the capital to this city.

During the reign of Ahmad ibn Muhammad, the Shirvanshah state was dependent on the Sallarid dynasty for a time and became independent again after the collapse of the Sallarids.

After Ahmad's death, his son Muhammad ruled for ten years (981-991). At first Mohammad was able to include the city of Gabala in his state. In 983, he rebuilt the castle walls of Shabran, then captured Barda, and appointed Musa as its governor. Khurasan, Tabasaran, Sheki and were also annexed by Shirvanshahs.

At the end of the tenth and beginning of the eleventh century they began to war on Derbent, and this rivalry lasted for centuries. In the 1030s they had to repel the raids of the Rus’ and Alans. The last ruler of the Mazyadid was Yazid ibn Ahmad. From 1027 to 1382, the Kasranids began to rule the Shirvanshahs. In 1032 and 1033, the Alans attacked Shamakhi, but were defeated by the troops of the Shirvanshahs. The Kasranid dynasty ruled the state independently until 1066, when the Seljuk tribes came to Azerbaijan and Shirvanshah Fariburz I accepted dependence on them, preserving internal independence.

In the 1080s, however, Fariburz, taking advantage of the weakening of his neighbors, also subject to Seljuk invasion, extended his power to Arran and appointed a governor in Ganja.

Sajid dynasty
The Sajid dynasty was an Islamic dynasty that ruled from 889–890 until 929. The Sajids ruled Azerbaijan first from Maragha and Barda and then from Ardabil.

Muhammad ibn Abi'l-SajDiwdad the son of Diwdad, the first Sajid ruler of Azerbaijan, was appointed as its ruler in 889 or 890. Muhammad's father Abu'l-SajDevdad had fought under the Ushrusanan prince AfshinKhaydar during the latter's final campaign against the rebel BabakKhorramdin in Azerbaijan, and later served the caliphs. For services rendered to the state, the Sajids were granted one of the largest and richest provinces of the Caliphate - Azerbaijan. Toward the end of the ninth century, as central authority of the Abbasid Caliphate weakened, he formed a virtually independent state. At the end of the ninth century (898-900) coins were minted named after Muhammad ibn Abu Saj. He succeeded in incorporating much of the South Caucasus into the Sajid state. The first capital of the Sajids was Maragha, although they usually resided in Barda.

Yusuf ibn Abi'l-Saj came to power in 901 and demolished the walls of Maragha and moved the capital to Ardabil. The eastern borders of the Sajid dynasty extended to the shores of the Caspian Sea, and the western borders to the cities of Ani and Dabil (Dvin). Yusuf ibn Abi'l-Saj's relations with the caliph were not good. In 908, a caliphate army was sent against Yusuf, but al-Muqtafi died and his successor, al-Muqtadir, sent a large army against Yusuf ibn Abi'l-Saj and forced him to pay 120 thousand dinars in tribute a year. Yusuf ibn Abi'l-Saj made peace with Sajid. Abu'l-Hasan Ali ibn al-Furat, the vizier of al-Muqtadir, played a key role in establishing peace, and afterwards Yusuf ibn Abi'l-Saj considered him his patron in Baghdad and often mentioned him on his coins. Peace allowed Yusuf ibn Abi'l-Saj to be invested with the governorship in Azerbaijan by the caliph in 909.

After the dismissal (in 912) of his protector in Baghdad, the vizier ibn al-Furat, Yusuf ibn Abi'l-Saj stopped making annual tax payments to the caliphate's treasury. According to Azerbaijani historian Abbasgulu aga Bakikhanov, from 908–909 to 919, the Sajids made the Shirvanshah Mazyadids dependent on them. Thus, in the beginning of the tenth century the Sajid state included territories from Zanjan in the south to Derbent in the north, the Caspian Sea in the east, and the cities of Ani and Dabil in the west, covering most of the lands of modern Azerbaijan.

During the reign of Yusuf ibn Abu Saj, Russian merchants attacked Sajid territory from the north from the Volga in 913–914. Yusuf ibn Abu Saj repaired the Derbent wall to strengthen the northern borders of the state. He also rebuilt the collapsed part of the wall at the sea.

In 914, Yusuf Ibn Abu-Saj organized a campaign against Georgia and chose Tbilisi for his center of military operations. He first occupied Kakheti and captured the fortresses of Ujarma and Bochorma, then returned after capturing several territories.

After the death of Yusuf ibn Abu Saj, the last ruler of the Sajid dynasty, Deysam ibn Ibrahim was defeated by the ruler of Daylam (Gilan), Marzban ibn Muhammad who ended the Sajid dynasty and founded the Sallarid dynasty in 941 with a capital in Ardabil.

Sallarid dynasty
The Sallarids were an Islamic dynasty that ruled the territory of Azerbaijan, as well as Iranian Azerbaijan, from 941 until 979. Marzuban ibn Muhammad ended the existence of the Sajid dynasty and founded the Sallarid dynasty in 941. He was the son of the founder of the Musafirid dynasty, Muhammad ibn Musafir, who ruled in Daylam. In 941, Marzuban, together with his brother Vahsudan, overthrew their father. In the same year, Marzuban set out to conquer Azerbaijan. He captured Ardabil and Tabriz, then extended his power to Barda, Derbent and also to the northwestern regions of Azerbaijan. The Shirvanshahs agreed become Marzuban's vassal and pay tribute.

In 943–944, the Russians organized another campaign to the Caspian region, much more brutal than the march in 913/14. As a result of this campaign, which affected the economic situation in the region, Barda lost its position as a large city and this position went to Ganja. The Sallarid army was defeated several times. The Rus captured Barda, the capital of Arran. The Rus' allowed the local people to retain their religion in exchange for recognition of their overlordship; it is possible that the Rus' intended to settle permanently. According to ibn Miskawaih, the local people broke the peace by throwing stones and other abuse at the Rus', who then demanded that the inhabitants evacuate the city. This ultimatum was rejected, and the Rus' killed people and held many others for ransom. The slaughter was briefly interrupted for negotiations, which soon broke down. The Rus' stayed in Bardha'a for several months, using it as a base to plunder the adjacent areas, and amassed substantial spoils. The city was saved only by an outbreak of dysentery among the Rus'. Marzuban then laid siege to Barda, but received the news that the Hamdanid amir of Mosul, Marzuban, left a small force to keep the Rus' in check, and in a winter campaign (945-946), defeated al-Husain. The Rus' meanwhile decided to leave, taking all the loot and prisoners they could. In 948, Marzuban was defeated by Hamadan and the ruler of Isfahan, Rukn al-Dawla, and was taken prisoner at Samiram Castle. After that, the territory of the Sallarids became the place of a ruthless struggle for power between Marzuban's brother Vahsudan, his sons, and Deysam Sajid. This momentary weakness in the central government allowed the Rawadids and Shaddadids to take control of the areas to the northeast of Tabriz and Dvin, respectively.

After Marzuban's death, Ibrahim, his youngest son, was appointed ruler of Dvin (957–979) and later Azerbaijan (962–966 and 966–979) by the caliph. According to Wilferd Madelung, in 968 Sallaryd İbrahim al Marzuban reaffirmed Sallarid authority over Shirvan and al-Bab (Darband). The Sallarid dynasty was forced to recognize the rule of the Shaddadids, who strengthened in Ganja in 971. Then they were assimilated by the Seljuk Turks at the end of the eleventh century.

Shaddadids
The Shaddadids were a Muslim dynasty that ruled the area between the rivers Kura and Araxes from 951 to 1199 AD. Muhammad ibn Shaddad is considered the founder of the Shaddadid dynasty. Taking advantage of the weakening of Sallarids, he took control of the city of Dvin and established his state. The Shaddadids eventually extended their power over the territories of Azerbaijan and ruled major cities such as Barda and Ganja.

According to Minorsky, Laskari ibn Muhammad and his brother Fadl ibn Muhammad fortified Ganja in 969 or 970 during the war with the Sallaryd dynasty, then captured Shamkir and Barda, and took power in Azerbaijan. Lashkari I ended Musafirid influence in Arran by taking Ganja in 971. Laskari ruled in Ganja for eight years, then Fadl ibn Muhammad established himself as emir of Arran from 985 to 1031. Al-Fadhl was the first Shaddadid emir to issue coinage, locating his mint first at Partav (Barda'a), and later at Ganja. He expanded the Shaddadids’ realm in Arran, capturing Baylagan in 993.

Fadl ibn Muhammad built the Khodaafarin Bridges across the Aras River to connect the territories on the north and south banks of the Aras. In 1030, he organized an expedition against the Khazar khaganate. In 1030, a new attack on Shirvanshahs by 38 Russian ships took place, and Shirvanshah Manučehr was roundly defeated. At that time, Fadl I's son Askuya rebelled in Beylagan. Fadl I's loyal son Musa paid the Russians to save Beylagan. As a result, Askuya's revolt was suppressed, and he was executed.

According to Minorsky, the period of AbulaswarShavur, who came to power after several changes in ruler, was called the zenith of the Shaddadid era. He was the last independent ruling Shaddadid emir. The Ziyarid prince Kaykāvus b. Eskandar mentioned Abu’l-Aswār as “a great king” in his Qābus-nāma, written when he lived for several years in Ganja fighting against the Byzantines. During Shavur's reign, the Shaddadids recognized the rule of the Seljuk sultan Togrul, who turned back Alan attacks from the north in 1063–1064, and maintained an allied relationship with the people of Tbilisi.

After Abulaswar Shavur died in Ganja in 1067, the reign of the Shaddadids in Ganja also came to an end. Fadl III, continued the rule of the Shaddadids in Arran, ascending the throne of Ganja in 1073. In 1075 Alp Arslan annexed the last of the Shaddadid territories. According to the anonymous Tariḵ Bab al-abwab, Alp Arslan appointed al-Bab and Arran as iqta to his slave Sav Tegin who seized these areas by force from Fażlun in 1075 and ended his reign. A branch of the Shaddadids continued to rule in the Ani emirate as vassals of the Seljuq Empire, while the others were assimilated by the Seljuqs.