Al-Qa'im (Abbasid caliph at Baghdad)

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; 8 November 1001 – 3 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 born on 8 November 1001. He was the son of Abbasid caliph al-Qadir (r. 991–1031) and his concubine named Qatr al-Nada (died 1060), an Armenian or Greek, also known as Alam.

His father, Al-Qadir had publicly 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 ascended to the throne.

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.

Reign
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, Khadija Arslan Khatun, to Al-Qa'im in 1056.

The Seljuk ruler Tughril 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 Tughril was acknowledged as Sultan by the Caliph in the public prayers. A few days after, Tughril 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.

The Turkic general Arslan al-Basasiri revolted in 1058 and successfully took Baghdad while Tughril was occupied with his brother's revolt in Iran. Al-Qa'im originally stayed in Baghdad during these events but was later exiled to Anah on al-Basasiri's orders. For about a year, al-Basasiri kept al-Qa'im as his hostage in Anah, as a bargaining chip in negotiations with Tughril. Tughril ended up securing al-Qa'im's freedom by going directly to the amir guarding him, bypassing negotiations with al-Basasiri altogether.

After al-Basasiri died and his revolt came to an end, the Seljuks were left as the single dominant power over al-Qa'im's caliphate. They were similar to the Buyids in this regard, although the Sunni Seljuks were more closely aligned with al-Qa'im in religious matters. Sectarian conflict was a prominent issue during this part of al-Qa'im's reign. A notable incident concerned the opening of the Nizamiyya of Baghdad, a madrasa affiliated with the Shafi'i legal school, in 1067; its opening inflamed tensions with the Hanbalis. Al-Qa'im was reluctant to act without first consulting with the Seljuk sultan and was ultimately unable to control the situation.

Fakhr ad-Dawla Muhammad ibn Muhammad ibn Jahir was appointed as vizier by al-Qa'im in 1062. Fakhr ad-Dawla arrived and was "showered with gifts, robes of honor, and the title Fakhr ad-Dawla ('glory of the dynasty')." According to Sibt ibn al-Jawzi, he was also given the additional title Sharaf al-wuzarā'.

Fakhr ad-Dawla's first tenure lasted until 1068, when he was dismissed for a series of "infractions" (dhunūb) he had committed. The reasons included "his presence in the Bāb al-Hujra (Privy Chamber) without permission, and his wearing of 'Adud ad-Dawla's ceremonial robes." In other words, he had been acting above his station. According to the diary of Abu Ali ibn al-Banna, the dismissal was on Tuesday, 9 September 1068. Fakhr ad-Dawla was "despondent and apologetic" and "acquiesced in tears". He was escorted out of Baghdad on Thursday night (11 September) and ended up traveling to the court of the Banu Mazyad ruler Nur ad-Dawla Dubays. His belongings were later sent to him.

The competition to replace Fakhr ad-Dawla as vizier was fierce. Three different candidates were seriously considered, but none of them successfully took office as vizier. The caliph's initial choice was Abu Ya'la, father of Abu Shuja al-Rudhrawari, but he died on 11 September - before Fakhr ad-Dawla had even left Baghdad. Another early front-runner was the za'im Ibn Abd ar-Rahim, who was sent a letter to inform him of his selection to the vizierate before someone brought his sordid past to the caliph's attention: he had been part of al-Basasiri's entourage during his rebellion in 1058, and he had taken part in looting the caliph's palace and "attacking" the women of the harem. His name was immediately removed from contention. At this point, around mid-late November, Ibn al-Banna wrote that a rumor had started to go around that al-Qa'im would reinstate Fakhr ad-Dawla as vizier. At some point, another candidate, a Hanbali named Abu'l-'Ala', was considered, but he never took office.

Meanwhile, Nur ad-Dawla Dubays had been making "entreaties to the caliph" on Fakhr ad-Dawla's behalf. Eventually, Fakhr ad-Dawla was brought back to serve as vizier. A group of administrative officials went out to meet with him on Sunday, 7 December, in advance of his return to Baghdad. Ibn al-Banna's diary gives the date of his reentry to Baghdad as Wednesday, 10 December 1068. Crowds came to watch and he was "met by the troops, the courtiers, and the leading figures". Vizieral robes of honor were made ready for him on 29 December, and they were bestowed upon him on Wednesday, 31 December. People went to congratulate him the next day. Then on Friday, 2 January 1069, he went on horseback to the Jami al-Mansur in the robes of honor; again, crowds gathered to see him, and in some places they "sprinkled" coins on him.

Al-Qa'im does not seem to have held a grudge against Fakhr ad-Dawla and entrusted him and his son Amid ad-Dawla with a wide range of duties. Sometime around 1071, there was a "diplomatic fracas" between Fakhr ad-Dawla and the Seljuk administration involving a delay in exchanging robes of honor. When Alp Arslan died in 1072, the Banu Jahir were tasked with overseeing the official mourning as well as the ceremonial exchange of loyalty and robes of honor between al-Qa'im and the new Seljuk sultan Malik-Shah I. On 26 September 1073, Fakhr ad-Dawla oversaw the signing of the controversial Hanbali scholar Ibn Aqil's public recantation of his beliefs at the caliphal chancery. This document of retraction is the only one of its kind to survive in full from the middle ages to the present day; the episode marked the ascendancy of traditionalism in Baghdad in the 11th century.

During this and the previous caliphs' period, literature, especially Persian literature, flourished under the patronage of the Buwayhids. The famous 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 Persian 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.

Family
One of Al-Qa'im's wives was the sister of Abu Nasr bin Buwayh also known as Malik Rahim. She died in 1049–50. Another wife was Chaghri Beg's daughter Khadija Arslan Khatun. She had been betrothed to his only son Dhakhirat al-Mulk Abu'al-Abbas Muhammad. However, Muhammad died, and Khadija Arslan married Al-Qa'im in 1056. After Al-Qa'im's death in 1075, she married Ali ibn Faramurz. One of Al-Qa'im's concubines was Al-Jiha al- Qa'mya, an Armenian.

His son Muhammad had a son, Al-Muqtadi, who succeeded his grandfather, born to an Armenian concubine named Urjuwan also known as Qurrut al-Ayn.

Al-Qa'im had a daughter named Sayyida. In 1061, Seljuk Sultan Tughril I sent the qadi of Ray to Baghdad, to ask her hand in marriage to him. The marriage contract was concluded in August–September 1062 outside Tabriz, with a marriage proportion of one hundred thousand dinars. She was brought to the Sultan's palace in March–April 1063. After Tughril's death, his successor Sultan Alp Arslan sent her back to Baghdad in 1064. In 1094, Caliph Al-Mustazhir compelled her to remain in her house lest she should intrigue for his overthrow. She died on 20 October 1102.

Death
When al-Qa'im was on his deathbed in 1075, Fakhr ad-Dawla took charge of his personal care - al-Qa'im did not want bloodletting but Fakhr ad-Dawla had it done anyway. Before he died, al-Qa'im advised his grandson and successor al-Muqtadi to keep the Banu Jahir in their position: "I have not seen better persons for the dawla than Ibn Jahir and his son; do not turn away from them."

Al-Qa'im died on 3 April 1074 at the age of 73. He was succeeded by his grandson Al-Muqtadi as the twenty-seventh Abbasid Caliph.