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.