al-Qa'im (Fatimid caliph)

'He who carries out God's orders'), was the twelfth Isma'ili Imam and second caliph of the Fatimid dynasty, ruling in Ifriqiya from 934 to 946, succeeding his father Abd Allah al-Mahdi Billah (r. 909–934).

Aided by sympathizers, the small group found refuge in to Ramla in Palestine and Fustat in Egypt, before turning west and making for the remote oasis town of Sijilmasa in what is now Morocco.

While there, the Isma'ili missionary (da'i) Abu Abdallah al-Shi'i, who had converted the Kutama Berbers, overthrew the Aghlabid dynasty ruling in Ifriqiya and established the Fatimid Caliphate on behalf of al-Mahdi.

The Fatimids were able to capture Alexandria and threaten the capital, Fustat, but ultimately failed due to strong Abbasid resistance, logistical challenges, and the indiscipline of their troops.

In the west, the defection of the Berber commander Musa ibn Abi'l-Afiya upended Fatimid control over Morocco, and al-Qa'im's generals campaigned in the area without achieving lasting success.

[1] Sa'id, like Abu'l-Shalaghlagh before him, was the leader of the clandestine Isma'ili missionary network, the da'wa ('invitation, calling'), ostensibly propagating the return of a hidden imam, Muhammad ibn Isma'il, as the mahdi, the Islamic messiah.

[8][9] The Bedouin rebels, calling themselves 'Fatimids', seized control of much of Syria and established a Shi'a regime on behalf of their hidden master, but despite receiving several letters urging him to join them, Sa'id remained in hiding at Ramla.

Sa'id decided to move to the Maghreb, in the western fringes of the Muslim world,[15] where one of his agents, the da'i Abu Abdallah al-Shi'i, had converted the Kutama Berbers to the Isma'ili cause, and by 905 had achieved some victories against the autonomous Aghlabid dynasty that ruled Ifriqiya (modern Tunisia and eastern Algeria) under nominal Abbasid suzerainty.

[22] Abu Abdallah installed a Shi'a government in the name of the absent and as yet unnamed imam,[23][24] and as soon as the new regime was stabilized, left with his army to bring Sa'id and his family to Ifriqiya.

[33] The explanation by al-Mahdi that he was merely one in a series of imams rather than the messiah of the end times,[34] and the reality of the new ruler as a man—a middle-aged merchant who loved the finer things in life—clashed with the doctrines that had been propagated by Abu Abdallah.

[37] Starting from Ikjan, the original centre of Abu Abdallah's mission, the revolt spread to the cities of Mila and Constantine, while a loyalist army sent against them was thrown back after many of the Kutama in its ranks defected.

[38] In response, in April/May 912, al-Mahdi officially proclaimed Abu'l-Qasim Muhammad as heir-apparent (wali al-ahd), gave him the regnal name al-qa'im bi-amr Allah ('He who executes God's command'), and placed him in charge of the army sent to quell the revolt.

[39] Following the consolidation of Fatimid rule in Ifriqiya, al-Mahdi's first objective was Egypt, the gateway to Syria and Iraq, the old heartlands of the Islamic world and seat of his Abbasid rivals.

[45][47] Unable to cross the river to Fustat, al-Qa'im led a large part of his army around Takin's defences and into the fertile Fayyum Oasis, where they could find provisions.

[55] As in 914, the Abbasid governor concentrated the few local forces at Giza, to defend the Nile crossing,[57] until Baghdad could send reinforcements: once again, Mu'nis al-Muzaffar was entrusted with the high command, departing for Egypt on 23 February 920.

[65] Once the Abbasid forces began to advance into the oasis, on 8 July al-Qa'im ordered the retreat: all heavy equipment was left behind, while he and his men made their way through the desert to the coastal road to Barqa, an arduous march in which many perished.

The heir-apparent set out on 12 April 927, issuing a general call to arms, not only to the Kutama, but also to the Arab militia (jund), which assembled at al-Aribus under Khalil ibn Ishaq al-Tamimi.

[71] Al-Qa'im then moved to Baghaya, from where he obliged the subdued Berber tribes, such as the Hawwara, Sadina, and Ajisa, to contribute men to his expedition; to ensure the latter's loyalty, the families of their chiefs were sent as hostages to Mahdiya.

[76] The campaign was hailed as a great success in Fatimid propaganda, but was marred by the escape of Ibn Khazar, who fled into the deep desert; al-Qa'im's men, with their supplies dwindling, could not follow him.

The motivation for this unusual move—whether as a result of palace intrigues or due to a genuine concern that al-Qa'im might be dead—and whether al-Mahdi truly intended to promote Ahmad as an alternative successor, remains unknown.

[78] As heir-apparent al-Qa'im is also mentioned as a frequent intermediary for making grievances known to his father, such as against the tyrannical behavior of the governor of Kairouan, Abu Sa'id al-Dayf,[79] or bringing to the caliph's attention the antinomian tendencies of some of the more extremist Isma'ili faithful in Ifriqiya, who claimed that al-Mahdi was God incarnate.

[85] Under al-Mahdi, the nascent Fatimid realm had expanded in three directions at once: against the Muslim "usurpers", the Abbasids in the east and the Umayyad Emirate of Córdoba in the west; while pursuing the holy war against the main Christian enemy, the Byzantine Empire, in the north, in Sicily and southern Italy.

[86] This expansion was ideologically driven: the Fatimid caliphs were not only the secular rulers of a state (dawla), but concurrently also Shi'a imams, at the head of the wide-ranging network of the da'wa, and thus challenging the Sunni Abbasids for the leadership of the entire Islamic world.

Khalil boasted of having killed one million people during his campaign, the cadastral registers were destroyed, thus making verification of the land tax impossible, many Sicilian Muslims were dispossessed and forcibly resettled, and many others fled to the Byzantine-controlled territories of southern Italy.

Al-Qa'im may have been intending to invade Egypt either way, and it is likely that his father had made preparations for this purpose, but this development provided him an excellent opportunity: troops under the freedman Zaydan and Amir al-Majun were immediately sent to Barqa to join the rebels.

[106][116] Fleeing from the Kharijites' advance, desperate Kutama soldiers and Fatimid adherents had flocked to al-Mahdiya, but al-Qa'im, determined to conserve supplies for the upcoming siege, had refused to admit them into the walls.

[119] The Fatimid position was difficult, as the ships bringing in grain supplies from Sicily and Tripoli ran aground and were captured by the rebels, but Abu Yazid also faced problems.

[124] During the following months, heavy fighting between Abu Yazid's and the Fatimid forces occurred at Tunis, which was captured and recaptured by both sides, and left almost completely destroyed.

[125] The veteran Fatimid partisan, Ali ibn Hamdun al-Andalusi, advanced from his stronghold of Msila against the Kharijites, but was defeated by Abu Yazid's son Ayyub and died of his wounds shortly after.

[134] The historian Farhat Dachraoui thus calls him "one of the less illustrious members of the dynasty",[134] and points out that his "excessive taxation and religious persecution", in his attempt to consolidate his rule, actually ended up encouraging the Kharijite uprising of Abu Yazid.

View of the ruins of Achir