Abū Ja'far Abdallah ibn Aḥmad al-Qādir () better known by his regnal name al-Qā'im bi-amri 'llāh () or simply as al-Qā'im; 1001 – 2 April 1075) was the Abbasid caliph in Baghdad from 1031 to 1075. He was the son of the previous caliph, al-Qadir. Al-Qa'im's reign coincided with the end of the Buyid dynasty's dominance of the caliphate and the rise of the Seljuk dynasty. Early life Al-Qa'im was the son of Abbasid caliph al-Qadir (r. 991–1031) and his mother was Badr al-Dija (also known as Qatr al-Nīda). He was born in Baghdad in 1001. He spend his childhood and early life in Baghdad. His father, Al-Qadir had public proclaimed his just nine-year-old son Muhammad (elder brother of Al-Qa'im) as heir apparent, with the title of al-Ghalib Bi'llah, in 1001. However, Muhammad died before his father and never access to the throne. Al-Qadir's proclamation of his son as heir was a response to the pretender Abdallah ibn Uthman. The Karakhanids soon recognized the Abbasid caliph's suzerainty for the first time, and dropped their support of the pretender. The pretender then arrived in Baghdad, where he secretly gathered support, before moving again to the east via Basra, Kufa, and Kirman. He was finally arrested by the Ghaznavids on al-Qadir's orders, and died in captivity. In 1030, al-Qadir named his son Abu Ja'far, the future Al-Qa'im, as his heir, a decision taken completely independently of the Buyid emirs. Al-Qadir died after an illness on 29 November 1031. Initially he was buried in the caliphal palace, but in the next year he was ceremonially moved to al-Rusafa. Al-Qa'im, meanwhile, received "the usual oath of allegiance" on 12 December 1031. Biography 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 Emir was often forced to flee the capital. At this point, the caliph had "very limited personal resources at his command", but he had recovered a bit of power from earlier periods and was able to arbitrate between the Buyid emirs Jalal al-Dawla and Abu Kalijar. In 1032, al-Qa'im sent the jurist al-Mawardi to meet with Abu Kalijar in secret; he was to refuse to grant him any title but "Malik al-Dawla". 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