Al-Qa'im (Arabic: القائم; 1001 – 2 April 1075), fully al-Qa'im bi-amri 'llah (القائم بأمر الله, "he who carries out the command of God"), was the Abbasid Caliph in Baghdad from 1031 to 1075. He was the son of the previous Caliph al-Qadir.
During the first half of al-Qa'im's long reign, hardly a day passed in the capital without turmoil. Frequently the city was left without a ruler; the Buwayhid ruler was often forced to flee the capital. While the Seljuk dynasty's influence grew, Chaghri Beg married his daughter, Arslan Khatun Khadija, to Al-Qa'im in 1056.
The Seljuk ruler Toghrül overran Syria and Armenia. He then cast an eye upon Baghdad. It was at a moment when the city was in the last agony of violence and fanaticism. Toghrül, under cover of intended pilgrimage to Mecca, entered Iraq with a heavy force, and assuring the Caliph of pacific views and subservience to his authority, begged permission to visit the capital. The Turks and Buwayhids were unfavorable, but Toghrül was acknowledged as Sultan by the Caliph in the public prayers. A few days after, Toghrül himself — having sworn to be true not only to the Caliph, but also to the Buwayhid amir, al-Malik al-Rahim, made his entry into the capital, where he was well received both by chiefs and people.
During this and the previous caliphs' period, literature, especially Persian literature, flourished under the patronage of the Buwayhids. The Turk philosopher al-Farabi died in 950; al-Mutanabbi, acknowledged in the East as the greatest of Arabic poets, and himself an Arab, in 965; and the greatest of all, the Iranian Abu Ali Husayn ibn Abdallah ibn Sina (Avicenna) in 1037.
In 1058 in Bahrain, a dispute over the reading of the khutba in Al-Qa'im's name between members of the Abd al-Qays tribe and the millenarian Ismaili Qarmatian state prompted a revolt led by Abu al-Bahlul al-Awwam that threw off Qarmatian rule and led to the unravelling of the Qarmatian state which finally collapsed in al-Hasa in 1067.