Fatimid invasion of Egypt (914–915)

The first Fatimid invasion of Egypt occurred in 914–915, soon after the establishment of the Fatimid Caliphate in Ifriqiya in 909. The Fatimids launched an expedition east, against the Abbasid Caliphate, under the Berber general Habasa ibn Yusuf. Habasa succeeded in subduing the cities on the Libyan coast between Ifriqiya and Egypt, and captured Alexandria. The Fatimid heir-apparent, al-Qa'im bi-Amr Allah, then arrived to take over the campaign. The attempts to conquer the capital, Fustat, were beaten back by the Abbasid troops in the province. A risky affair even at the outset, the arrival of Abbasid reinforcements from Syria and Iraq under Mu'nis al-Muzaffar doomed the invasion to failure, and al-Qa'im and the remnants of his army abandoned Alexandria and returned to Ifriqiya in May 915.

Background
The Fatimids arrived to power in Ifriqiya in 909, when they overthrew the reigning Aghlabid dynasty with the support of the Kutama Berbers. In contrast to their predecessors, who were content to remain a regional dynasty in the western fringes of the Abbasid Caliphate, the Fatimids held ecumenical pretensions: as an Isma'ili Shi'a sect claiming descent from Fatima, the daughter of Muhammad and wife of Ali, they regarded the Sunni Abbasids as usurpers and were determined to overthrow them and take their place. Thus in early 910 the Fatimid ruler Ubayd Allah declared himself imam and caliph as "al-Mahdi Billah" ((r. 909 – 934)).

In line with this imperial vision, following the establishment of their rule in Ifriqiya, the Fatimids' next objective was Egypt, the gateway to the Levant and Iraq, the seat of their Abbasid rivals. The direct route from Ifriqiya to Egypt led through modern Libya. Apart from the few cities on the coast at Tripolis and Cyrenaica, this was a country dominated by Berber tribes—from west to east the Nafusa, Hawwara, Mazata and Luwata—which during the previous centuries had been Islamicized, although incompletely; thus the Nafusa were still Kharijites, while the Mazata were Muslim in name only. Only in the Cyrenaica and to the east there existed true Arab Bedouin, who had migrated there in the 9th century.

The Fatimids entered the area in 911, when Kutama chieftains raided up to the territories of the Luwata. Around Tripolis, which had submitted after the fall of the Aghlabids, the Hawwara tribesmen quickly came to resent the overbearing behaviour of the Fatimids' Kutama soldiery, as well as their heavy tax demands. A first uprising and siege of the city in 910–911 was followed by a general revolt in summer 912, which also engulfed the city. The Fatimid governor fled, and all Kutama were slaughtered. The Fatimid heir-apparent, al-Qa'im bi-Amr Allah led a combined land and naval expedition against them. After Tripolis capitulated in June 913, al-Qa'im left the powerful Kutama general Habasa ibn Yusuf there, to prepare the further eastward expansion of the Fatimid empire.

Invasion of Egypt
The 15th-century Isma'ili historian, Idris Imad al-Din, provides the most details about the expedition against Egypt, and is complemented by Sunni sources such as al-Tabari and al-Kindi.

Conquest of the Cyrenaica
The expedition against Egypt was launched on 24 January 914, when the army under Habasa ibn Yusuf departed Tripoli. The Fatimid army took the coastal route. The Abbasid garrisons of Sirte and Ajdabiya abandoned these towns without battle, and on 6 February Habasa entered Barqa, the capital of Cyrenaica. The conquest of Cyrenaica promised to be beneficial to the Fatimid treasury: the land tax (kharaj) brought in 24,000 gold dinars annually, with another 15,000 dinars provided by the jizya paid by the Christian dhimmi, the zakat, and the ushr.

According to Imad al-Din, Barqa was evacuated without battle, but Sunni sources claim that the Fatimid troops committed atrocities against the inhabitants and extorted funds from the local merchants. Thus he forced the local pigeon merchants to roast and eat their ware, suspecting them of using their birds to spy for the Abbasids. He urged the members of the local Arab militia (the jund) to enrol in the Fatimid army, while imposing considerable financial levies on the town's population. He furthermore executed two chieftains of the Mazata, who nine years before had waylaid and robbed al-Mahdi during his journey to Ifriqiya; their sons were also killed, while their womenfolk were sold into slavery and their possessions confiscated.

News of the Fatimids' arrival in Barqa provoked the Abbasid authorities in Egypt to send an army against them. Habasa's men, reinforced by fresh troops from Ifriqiya, won the ensuing battle on 14 March.

Capture of Alexandria
Encouraged by this success, al-Mahdi sent his son and heir, al-Qa'im, with another army east to assume command of the expedition. At the head of a force comprising numerous Kutama as well as members of the Arab jund of Ifriqiya, al-Qa'im set out from al-Mahdi's residence at Raqqada on 11 July. He arrived at Tripoli on 1 August, writing to Habasa to await his coming before invading Egypt proper. Disregarding these orders, however, the ambitious Habasa led his forces into Egypt; after defeating an Abbasid force at al-Hanniya (near modern El Alamein), on 27 August 914 he entered Alexandria. The Kutama raided south along the Nile and devastated the country, reaching up to Giza across from the capital of Egypt, Fustat. Habasa wrote to the local governor, Takin al-Khazari, offering safe-conduct (amān) in exchange for his surrender, but Takin refused. Al-Qa'im arrived in Alexandria on 6 November 914, where he imposed the Fatimid cry to prayer, a Kutama governor, and an Isma'ili qadi (judge).

In the meantime, the arrival of the Fatimid army in Alexandria provoked panic in Baghdad. The Abbasid government had paid little attention to the affairs of Ifriqiya and the claims of al-Mahdi, but now urgent enquiries were made as to his origin and intentions. Takin urgently requested reinforcements, and the Syrian provinces were mobilized; already in September 914, the first Syrian troops began arriving in Fustat. In October, the Abbasid caliph al-Muqtadir appointed his chamberlain Mu'nis as commander-in-chief and ordered him to Egypt. To support the expedition, and alleviate the financial burden on the Egyptian populace of the expeditionary force, two million silver dirham were allocated by the treasury.

March on Fustat and first battle at Giza
In early December, as the Nile floods withdrew and allowed for the passage of armies along the river, the Fatimid army set out for Fustat in two columns: Habasa ahead, with al-Qa'im following behind. As Fustat lay on the eastern bank of the Nile, and the only way to cross to it was by the pontoon bridge to Rawda Island and Giza, Takin al-Khazari mobilized the garrison and the inhabitants of the city and set up a fortified camp at Giza.

On 13 December, the first alarm was raised in Fustat, with anyone able to bear arms rushing over the bridge, but no attack ensued. This was repeated the next day, and only on the day after did the Fatimids attack. In the ensuing battle, the Abbasid forces prevailed, as Takin's Turkish horse-archers inflicted heavy casualties on the Kutama lancers. The Egyptian forces pursued the Kutama into the night, but during the pursuit the inexperienced levies fell into an ambush, saving the Fatimid army from a complete rout. The Egyptians remained tense, with another false alarm on the next day, but only minor skirmishes occurred during the next few days. Despite this setback, some of the Egyptians (Christian Copts and Muslims alike) corresponded with al-Qa'im, revealing the continued presence of an element of possible sympathizers and, according to Heinz Halm, possibly the presence of a Fatimid missionary (da'i) in Fustat.

Occupation of Fayyum and defeat at Giza
Unable to cross the river to Fustat, al-Qa'im moved with a large part of the army around Takin's defences and into the fertile Fayyum Oasis, where they could find provisions. The Kutama initially plundered the area, but al-Qa'im restored order and imposed a regular tax regime on the inhabitants.

At this point, al-Qa'im and Habasa, who had remained behind in command of the bulk of the Fatimid army at Giza, fell out when al-Qa'im ordered Habasa replaced. On 8 January 915, in a large-scale battle at Giza, the Fatimids were decisively defeated; Fatimid sources unanimously attribute this defeat to Habasa, who fled the battlefield, despite al-Qa'ims exhortations to stand firm. The pro-Fatimid accounts maintain that al-Qa'im launched three attacks on the enemy and caused many casualties, but these embellishments cannot hide the fact that the battle was a disaster: with his army collapsing, al-Qa'im retreated to Alexandria, which he entered on 23 January.

Fatimid withdrawal from Alexandria and revolt in Cyrenaica
Despite the setback, in his letters to his father, and the surviving sermons that he delivered in Alexandria, al-Qa'im appears not to have lost confidence in his ultimate success. For a while, he also engaged in negotiations with some Egyptian defectors, who asked for amān from al-Qa'im, and raised the prospect of a capitulation of Fustat. It appears that al-Qa'im himself was not entirely convinced of the sincerity of such proposals, which either way became impossible when the Abbasid commander-in-chief Mu'nis arrived at Fustat in April 915. Mu'nis dismissed Takin and replaced him with Dhuka al-Rumi.

Soon after, Habasa with thirty of his closest followers deserted al-Qa'im and made for Ifriqiya; alarmed by this, al-Qa'im evacuated Alexandria hastily and without battle, leaving much of his armament and equipment behind. Dhuka occupied the city and installed a strong garrison under his son al-Muzzafar, before returning to Fustat to mete out punishment to those elements suspected of corresponding with al-Qa'im. Al-Qa'im arrived at Raqqada on 28 May 915. In his rear, Cyrenaicaa rose in revolt and overthrew Fatimid control; in Barqa, the entire Kutama garrison was killed.

Analysis
The invasion was costly in blood on both sides: 7,000 Fatimid troops were killed and another 7,000 were taken prisoner in the first round of fighting alone, while in the second round, Habasa's troops are said to have lost 10,000 men killed. Losses among the conscripted Egyptian population range from 10,000 to 20,000 dead, while Imad al-Din put the total number of Egyptians killed as high as 50,000.

Both sides suffered from indiscipline and lack of cohesion in their own ranks. Habasa repeatedly acted without consulting al-Qa'im, and committed several atrocities against civilians; his abandonment of the battlefield doomed the expedition, and on his return to Ifriqiya, he was executed. Several Fatimid troops defected, while al-Qa'im too had to struggle to impose discipline on his men, who looted the Fayyum. The Abbasid side also experienced defections, quarrels among the commanders, as well as the willingness of many Egyptians to come to terms with the Fatimid invader, leading to brutal reprisals by the Abbasid authorities against those who corresponded with al-Qa'im.

The Fatimid expedition itself was considered risky even at the time. The Fatimids' rule in Ifriqiya was still not secure and was plagued by constant rebellions; the Fatimid navy had been destroyed in 913 during such a revolt by the governor of Sicily. The 10th-century Fatimid propagandist al-Qadi al-Nu'man even reports that al-Qa'im was reluctant to embark on the expedition, and argued with his father in favour of delaying it. Indeed, according to Michael Brett, the Fatimid invasion failed chiefly "because the expedition found itself deep in the interior of the country, on the desert bank of the Nile across the river from the Egyptian capital, confronted by a garrison which had been able to call upon the forces of the empire at its back". The precariousness of the first Fatimid invasion becomes even clearer when contrasted with the elaborate military preparations and infiltration of the country by Fatimid agents undertaken for several years before its final conquest in 969.

Aftermath
The expedition's failure rocked the fundaments of Fatimid regime: the belief in the divine mission of the Imam-Caliph was shaken, and discontent arose, particularly among the Kutama sub-tribe of the Malusa, from whom Habasa, now hounded as a criminal, originated. His capture and imprisonment led to the revolt of his brother Ghazwiyya, who had played a crucial role in securing al-Mahdi's regime up to that point, and who recently had been given charge of the entire Kutama country to the west of Ifriqiya. The revolt was quickly crushed, however, and Ghazwiyya and Habasa were executed. When their heads were brought before al-Mahdi, he is said to have exclaimed "Once did these heads enclose the East and West; and now they are contained within this basket!".

Despite their failure, the Fatimids launched a second invasion in 919, which was also defeated. Apart from a brief intervention in the internal conflicts of the military factions in Egypt in 935, it was not until 969 that another serious invasion was undertaken. By then, the Abbasid Caliphate, weakened by constant power struggles between rival bureaucratic, court, and military factions, and deprived of its outlying provinces to ambitious local dynasts, had ceased to exist as a political entity, with the Abbasid caliphs a powerless pawn of the Buyids; while the Fatimid regime had grown stronger and far more wealthy, and now disposed of a large and disciplined army. This time the Fatimids met little resistance, and Egypt was conquered.