Abū al-Qāsim Muḥammad ibn ʿAbd Allāh (Arabic: أبو القاسم محمد ابن عبد الله; March/April 893 – 17 May 946), better known by his regnal name al-Qāʾim (القائم) or al-Qāʾim bi-Amr Allāh (Arabic: القائم بأمر الله, lit. '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).
Born in March or April 893 in the Syrian town of Salamiyah, where his father, under the guise of a wealthy merchant, was leading the clandestine Isma'ili missionary network. Al-Qa'im and his father had to flee Salamiyah in 903 to avoid Abbasid persecution under the impact of a pro-Isma'ili revolt in Syria. 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. After al-Mahdi's accession, al-Qa'im was officially made the designated successor and played a significant role during his father's reign as a military commander. He suppressed a Kutama revolt that broke out after the murder of Abu Abdallah al-Shi'i, captured Barqa, and led two invasions of Egypt, in 914–915 and 919–921. 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 927, al-Qa'im led a campaign to suppress the Zenata Berbers in what is now central Algeria. He secured Fatimid control of Tahert, received the submission of the Sanhaja Berbers, and founded the city of al-Muhammadiya (modern Msila) as a stronghold to control the region.
After al-Mahdi's death in March 934, al-Qa'im succeeded without opposition, and mostly kept his father's ministers in place. A Fatimid naval raid sacked Genoa in northern Italy in the same summer, but the Fatimid position in the central Mediterranean was challenged by an anti-Fatimid revolt broke out in Sicily in 937 that was not suppressed until 940. 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. Another attempt to invade Egypt was launched in 935, but it was quickly defeated by the new local strongman, Muhammad ibn Tughj al-Ikhshid. The main event of al-Qa'im's reign was the great revolt led by the Kharijite preacher Abu Yazid, who mobilized Berber tribes as well as Arab townsmen against Fatimid rule, made unpopular by its strict taxation, unpopular Isma'ili doctrine, and the exactions of the unruly Kutama soldiery. The rebellion began in February 944 and rapidly gained momentum, resulting in the surrender of Kairouan and the siege of the Fatimid capital, al-Mahdiya. Al-Qa'im died on 17 May 946 in al-Mahdiya, with the rebellion still ongoing. His son, Isma'il, succeeded him as al-Mansur Billah and eventually quelled the uprising.
The future al-Qa'im was born in the Syrian town of Salamiyah in March or April 893, with the birth name Abd al-Rahman. Abd al-Rahman's father was Sa'id ibn al-Husayn, the future Caliph Abd Allah al-Mahdi Billah. Abd al-Rahman's mother was Sa'id's paternal cousin, the daughter of Abu Ali Muhammad, known as Abu'l-Shalaghlagh, who had fostered Sa'id when he became orphaned as a youth; her name is not recorded.
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. Sometime before 899, Sa'id began claiming that he was the actual hidden imam, descended from a line of hidden imams; and that Muhammad ibn Isma'il had been only a fiction and a cover name to mask their activities. These claims may even have begun before Sa'id assumed control of the da'wa: the family eunuch Ja'far reports in his memoirs that already Abu'l-Shalaghlagh had secretly claimed to a few senior agents the title of mahdi for Sa'id, and the title of qa'im for the newly born Abd al-Rahman. These claims caused a schism in the Isma'ili movement in 899, between those who recognized Sa'id's claims to the imamate and those who rejected them and continued to await the return of Muhammad ibn Isma'il as the mahdi. The latter are generally known by the term "Qarmatians".
He was married already at an early age, before his family left Salamiya. His wife, Umm Habiba, apparently was still a child when she accompanied him to the Maghreb. He also had six known concubines, of which one, Karima, became the mother of his successor al-Mansur.
After Sa'id's revelation that he was the hidden imam, some of his most fervent followers launched a series of Bedouin uprisings in Syria against the Abbasid Caliphate in 902. Sa'id had not been consulted beforehand, and the outbreak of these revolts put him in danger, as his identity and location were revealed to the Abbasid government. The Abbasids launched a manhunt against him, so Sa'id took Abd al-Rahman and a few other close members of his household and left Salamiyah for Ramla in Palestine. There the local governor, secretly an Isma'ili convert, hid them from the Abbasid pursuit. 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. The rebels were finally defeated in November 903 by the Abbasid army, and their leader captured and interrogated.
This once again forced Sa'id to abandon Ramla for Fustat in Egypt, then ruled by the autonomous Tulunid dynasty. Sa'id, Abd al-Rahman, and their small entourage stayed there until January 905, when the Abbasids invaded the country and overthrew the Tulunid regime. Sa'id decided to move to the Maghreb, in the western fringes of the Muslim world, 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. On the journey west one of the group's members, Abu Abdallah's brother Abu'l-Abbas Muhammad, was arrested, and the Aghlabids learned about the identity and the appearance of the group's members. As a result, the group skirted the Aghlabid territory along its southern borders and made for the oasis town of Sijilmasa in what is now eastern Morocco. Sa'id, Abd al-Rahman, and their small entourage settled in Sijilmasa, leading the comfortable life of wealthy merchants, for the next four years.
Heir-apparent and military commander
In March 909, the Kutama under Abu Abdallah al-Shi'i finally defeated the last Aghlabid army, forcing Emir Ziyadat Allah III into exile and capturing the capital of Ifriqiya, Kairouan, and the nearby Aghlabid palace city of Raqqada. Abu Abdallah installed a Shi'a government in the name of the absent and as yet unnamed imam, and as soon as the new regime was stabilized, left with his army to bring Sa'id and his family to Ifriqiya. Learning of the approach of the Kutama army, the emir of Sijilmasa had Sa'id questioned and put under house arrest along with Abd al-Rahman, but otherwise they were treated well. Their servants on the other hand were thrown into prison, and regularly whipped. On 26 August 909, the Kutama army reached Sijilmasa, and demanded the release of their captive imam. After brief clashes with the Midrarid troops, Emir al-Yasa fled his city, which was occupied and plundered. Mounted on horseback and dressed in fine clothes, Abd al-Rahman and his father were presented to the army, amidst shouts and tears of religious exaltation. On the next day, 27 August, Sa'id was enthroned and acclaimed by the troops.