# First Qarmatian invasion of Egypt

The First Qarmatian invasion of Egypt took place in 971, when the Qarmatians of Bahrayn unsuccessfully invaded Egypt, which had recently been conquered by the Fatimid Caliphate. Both the Qarmatians and the Fatimids were offshoots of the Isma'ili sect of Shi'a Islam, but belonged to different and rival branches. Following the takeover of Egypt under the general Jawhar in 969, the Fatimids began their expansion into the Levant. There they confronted the Qarmatians, who in previous years had raided and extracted tribute from the regional potentates. In order to stop the Fatimid advance, the Qarmatians, led by al-Hasan al-A'sam, joined in a league with other regional powers, including the Sunni Abbasid caliph in Baghdad. After defeating and killing the Fatimid commander Ja'far ibn Fallah at Damascus in August 971, the Qarmatians and their Bedouin allies marched south. A Fatimid relief army marching to assist Ibn Fallah withdrew to Jaffa where it was blockaded, while the main Qarmatian army invaded Egypt. The diversion of the Qarmatian forces into the Nile Delta in support of local revolts gave Jawhar the time to mobilize his remaining forces and prepare defences in the form of a trench and wall at Ayn Shams, just north of Cairo, then still under construction as the new Fatimid capital. At a battle north of the city on 22 and 24 December, Jawhar defeated the Qarmatians and forced them to withdraw from Egypt in disorder. After the Qarmatians quarreled with their Bedouin allies, the Fatimids were able to reoccupy Ramla, but this was short-lived; by the summer of 972, Palestine was again under Qarmatian control. On the other hand, the rebellions in Egypt were suppressed, and the Fatimid caliph al-Mu'izz was able to move his capital from Ifriqiya to Cairo in June 973. A second invasion followed in 974, which was also defeated, ending the Qarmatian threat for good, and paving the way for the Fatimid expansion into the Levant.

## Background

In 899, a split occurred in the clandestine Isma'ili movement, directed by the family of the future first Fatimid caliph, Abdallah al-Mahdi. Al-Mahdi claimed to be not only a trustee and representative of the hidden imam, but the true imam in person. Those that rejected this claim became known as the "Qarmatians". Whether out of genuine conviction or political expediency, the missionary Abu Sa'id al-Jannabi, who had established his rule in much of Bahrayn, sided with the latter faction. Allied with the local Bedouin tribes of the Banu Kilab and Banu Uqayl, as well as with the Persian Gulf merchants, Abu Sa'id was able to capture the region's capital, Hajr, and in 900 cemented his independence by defeating an Abbasid army sent to recover control of Bahrayn.
The two Isma'ili branches developed in separate ways after the 899 schism. The Fatimid Caliphate was established in 909 in Ifriqiya. After failing to capture Egypt early on and expand into the central lands of the Islamic world held by the Abbasid Caliphate, the Fatimids focused their energy in consolidating their hold on the Maghreb and fighting against the Byzantine Empire on Sicily. At the same time the Qarmatians, after a period of initially peaceful relations with the Abbasids, and driven by millennialist expectations of Abu Sa'id's younger son, Abu Tahir al-Jannabi, launched a series of attacks in the 920s that culminated in the Sack of Mecca in 930. As the expected mahdi failed to come, the Qarmatians returned to more peaceful relations after 939, sustained through payments of money to abstain from attacking the Hajj caravans. As the dominant power in the eastern and northern Arabian peninsula, the Qarmatians even began offering their services as—well paid—guards of the Hajj caravans; when the Bedouin tribe of the Banu Sulaym raided the caravans in 966, the Qarmatians forced them to return their plunder. Another wave of Qarmatian raids was launched in the 960s, directed against the Ikhshidid holdings in the Levant. Frequently allied with the perennially restless Bedouin tribes of the Syrian Desert, the Qarmatians raided the caravans of merchants and Hajj pilgrims alike, with the Ikhshidids unable to counter their attacks. In 968, the Qarmatians under al-Hasan al-A'sam even captured Damascus and Ramla, withdrawing only after they secured a ransom and an annual tribute of 300,000 gold dinars from the Ikhshidid governor. The Qarmatian attacks undermined the Ikhshidid regime, and effectively severed the overland routes from Egypt and western Arabia to Iraq, helping pave the way for the swift and almost bloodless takeover of Egypt from the Ikhshidids by the Fatimid general Jawhar in 969.
Medieval historians, as well as some of the first modern scholars to examine Isma'ili history, saw a collusion between the Fatimid enterprise in the west and the Qarmatian attacks in the east, but more recent scholarship has disproven this. The Fatimid caliph al-Mu'izz (r. 953–975) made several attempts to get the scattered Qarmatian communities to recognize his leadership, but although these efforts were successful in some areas, the Qarmatians of Bahrayn persistently refused to do reconcile themselves to Fatimid claims. In reality, the Fatimid conquest of Egypt and the subsequent advance into Syria, which led to the defeat of the last Ikhshidid remnants at the hands of the Fatimid general Ja'far ibn Fallah in April 970, brought the two Isma'ili powers on a collision course. The Fatimid expansion meant the end of the annual tribute paid the Qarmatians by the Ikhshidids, and the Fatimids' declared intention to restore the safety of the Hajj routes threatened to put an end to the Qarmatians' extortion of the Hajj caravans as well. In addition, the Fatimid hold over Syria was still shaky, and they enjoyed little local support, especially in Damascus, where the populace had resisted, despite being abandoned by their Ikhshidid governor, and the exactions of the Fatimids' Kutama soldiery after the city's fall had further exacerbated the locals' hatred. The Damascene popular leader Muhammad ibn Asuda even fled to Bahrayn, accompanied by the chieftain of the powerful Bedouin tribe of Banu Uqayl, Zalim ibn Mawhub, to seek Qarmatian support.

## Anti-Fatimid coalition and the fall of Syria

As a result, the Qarmatians decided to make common cause with the other regional powers against the Fatimids: Through the mediation of the Abbasid caliph al-Muti', the Qarmatians became the nucleus of a broad anti-Fatimid alliance, comprising the Hamdanid ruler of Mosul, Abu Taghlib, the Buyid ruler Izz al-Dawla, the Bedouin tribes of Banu Kilab and Banu Uqayl, and remnants of the Ikhshidid troops. The Buiyds promised the Qarmatians the sum of 1,400,000 silver dirhams, as well as a thousand complete sets of armour and weaponry for their warriors.
The Qarmatian army set out from Bahrayn in 971, moving to Kufa, Rahba, and Palmyra, gathering allies, arms and money at each stop along the way. As they approached Damascus, Ibn Fallah chose to confront the allies in open battle in the desert. On 31 August 971, the Qarmatians outflanked the Fatimid army and destroyed it, with Ibn Fallah falling on the battlefield. Upon receiving news of the disaster, Fatimid reinforcements, sent by Jawhar and commanded by Sa'adat ibn Hayyan, withdrew to the coastal town of Jaffa where they fortified themselves. Al-As'am entered Damascus, where he read the Friday sermon on behalf of al-Muti', denouncing the Fatimids as impostors and their claims to Alid descent as false. His forces then marched south, capturing and plundering the undefended Ramla on 5 September. Across Syria, the Friday prayer was once more read on behalf of the Abbasid caliph.
Lacking siege engines, al-A'sam chose to bypass Jaffa, but left a strong force to blockade Ibn Hayyan's 11,000 men under the overall command of Alid Akhu Muslim, and with the Qarmatian commander Abu'l-Munaja Abdallah ibn Ali and the Uqaylid chieftain Zalim ibn Mawhub. The blockade of Jaffa was joined on the sea side by Qarmatian warships, but they proved no match for the Fatimid navy, which threw flasks of oil on the Qarmatian ships' decks, ignited them, and sunk the ships. While the blockade continued on land, Ibn Hayyan's men could at least be resupplied by sea.

## Qarmatian invasion of Egypt

The fall of Damascus and then Ramla made the threat of a Qarmatian invasion of Egypt imminent. Jawhar had lost much of his army in battle or blockaded in Jaffa, and disposed of only a fraction of his original force that had set out to conquer Egypt and the reinforcements he had received in the meantime. He was also afraid of treachery; pamphlets insulting him were discovered at the Mosque of Amr in Fustat, the old capital of Egypt. Jawhar especially distrusted the machinations of the former Ikhshidid vizier, Ja'far ibn al-Furat, and ordered him placed under surveillance and moved to the new capital, Cairo, that Jawhar had been constructing north of Fustat. To protect the newly built city, whose walls were not yet finished, he ordered the excavation of a broad trench just to its north, at the plain of Ayn Shams, between the Nile River and the Muqattam Hills, a distance of c. 10 kilometres (6.2 mi). A wall was erected behind the trench with only two gates, a large and a small one, which were equipped with iron doors brought from the gardens of the Ikhshidid regent Kafur, whose site was now occupied by Cairo. Urgent requests for the dispatch of reinforcements were sent to al-Mu'izz in Ifriqiya.
A month after his capture of Damascus, al-A'sam's forces entered Egypt, capturing Qulzum (modern Suez). Instead of taking the direct route for Fustat, however, the Qarmatians turned west, to the Nile Delta. In October, the Qarmatians captured al-Farama (Pelusium) and proceeded to occupy much of the eastern Delta. The region—which had rebelled against harsh taxation in the previous year—erupted in revolt, and an anti-Fatimid uprising broke out in Tinnis. Revolts also broke out in Upper Egypt, and everywhere pro-Abbasid black banners were raised by the rebels. Jawhar took advantage of the Qarmatians' diversion into the Delta to finish his fortifications at Ayn Shams, to raise troops from among the disbanded Ikhshidid soldiery, and to distribute arms to the officials and other civilians who had followed his army from Ifriqiya. The reliability of Jawhar's improvised army was dubious; 900 soldiers were arrested or imprisoned on disciplinary infractions alone. In an effort to improve discipline and cow unrest in Fustat, public executions of soldiers who deserted were undertaken, as well as a parade of the heads of executed Banu Hilal chieftains who had rebelled against the Fatimids. A Fatimid army under Yaruq recaptured Tinnis in late October or early November, but within a few weeks the revolt spread across the Delta, forcing Yaruq to retreat to Fustat, the Qarmatians at his heels. On Friday, 22 December 971, the Qarmatians arrived before Jawhar's fortifications at Ayn Shams.
The Qarmatians immediately launched an attack on the trench on 22 December, but failed, with heavy losses on both sides. After resting on Saturday, the attack was repeated on Sunday, 24 December, with the Qarmatians slowly gaining the upper hand. As the sun was setting behind the Fatimid lines, Jawhar opened the large gate and launched a counterattack on the Qarmatian right with his last reserves, Black African slave-soldiers and Berber infantry. The Qarmatian right wing, likely held by the more unreliable Bedouin, disintegrated, cutting their army off from the Nile and forcing them into a general and disorderly retreat. The Qarmatians' Bedouin allies of Banu Uqayl and Banu Tayy profited from the confusion to plunder their baggage train, while Jawhar's men seized and plundered the Qarmatian camp, seizing al-A'sam's treasure and library.
Two days after the Qarmatian defeat, the long-awaited reinforcements from Ifriqiya arrived in Fustat under Ibn Ammar. Fearing a ruse, Jawhar did not pursue the retreating Qarmatians, but ordered a bounty on their heads, whereupon many dispersed Qarmatians were killed by the locals. Shocked by their first major defeat in open battle, the Qarmatians were not able to regroup and recover their cohesion until they had reached Palestine.

## Aftermath

The Qarmatian retreat opened the way for the restoration of Fatimid control in Egypt. The revolt in the Delta persisted for a few years, especially as Jawhar could not spare the necessary resources to confront it. It was only in the summer of 972 that troops under Ibn Ammar began a brutal suppression campaign. The Qarmatians sent a fleet to assist Tinnis, but in September/October 972 (or 973) seven Qarmatian ships and 500 crew were captured by the Fatimid forces. Tinnis capitulated soon after. In Upper Egypt, the Kilabi leader Abd al-Aziz ibn Ibrahim, formerly a Fatimid ally, maintained his revolt in the name of the Abbasid caliph. An expedition under the Nubian commander Bishara was sent against him, and he was captured and brought to Cairo in a cage. He died there in February 973, his corpse being publicly flayed afterwards. Following the repulsion of the Qarmatian attack, and despite the continuing unrest, Jawhar judged Egypt to be sufficiently pacified to invite his master, al-Mu'izz, to come to Egypt. The Fatimid caliph and his court left Ifriqiya in late 972 and arrived in Cairo on 19 June 973, with al-Mu'izz relieving Jawhar from his post as viceroy and taking up the reins of Egypt himself.
The situation was different in Palestine. A Fatimid army under the command of Ibrahim ibn Ja'far ibn Fallah managed to break the blockade of Jaffa, aided by dissent in the opposing coalition. The Qarmatian Abu'l-Munaja and the Uqaylid Ibn Mawhub quarreled over the division of the land tax proceeds. Abu'l-Munaja, who claimed the entire revenue for himself, imprisoned Ibn Mawhub, but the latter managed to escape, whereupon the Banu Uqayl withdrew from the coalition. Left weakened against the Fatimids, the Qarmatians withdrew towards Damascus. Ramla was briefly reoccupied by Ibrahim's troops in May 972, but the Qarmatians soon returned and the Fatimids had to withdraw to Egypt, where Sa'adat ibn Hayyan soon died. Al-A'sam began preparing another invasion of Egypt, which was defeated north of Cairo in April 974. Once more the Qarmatians were pushed back to Syria, but this time they were unable to regroup there and had to return to Bahrayn. This marked the end of Qarmatian involvement in the affairs of Syria, allowing the Fatimids to recapture Ramla. When al-Mu'izz died in December 975, Fatimid rule over Egypt had been consolidated, but the Fatimid expansion into the Levant was still blocked. It was left to Caliph al-Aziz (r. 975–996) and his vizier, Ya'qub ibn Killis, to pursue the Fatimid conquest of Syria, and engage in a long contest for supremacy over northern Syria and the declining Hamdanid emirate of Aleppo with the Byzantine Empire. In 992, the declining Qarmatians of Bahrayn, defeated by the Buyids and restricted to their original territory, also formally recognized the political suzerainty of the Fatimid caliphs, while retaining their distinct doctrines.