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 dominance of Buyid amirs over the Caliphate and the rise of the Seljuk sultans.

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.

Al-Qaim had other siblings, a brother name Abu'l-Qasim ibn al-Qadir and a sister named Fatima bint al-Qadir who died in 1056, during his reign.

Reign Early 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".

During his reign and of 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 1043, Lahore's Ghaznavid governor Faqih Salti marched against Abul Fateh Daud's son. The Ismaili forced withdrew to Mansura. Multan was surrendered to the Ghaznavids and the khutbah was now read for the Abbasid Caliphate than the rival Fatimids.

Defeat of Arslan al-Basasiri and Recognition of Tughril as Sultan by al-Qa'im The new 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.

While the Seljuk dynasty's influence grew, Chaghri Beg married his daughter, Khadija Arslan, to Al-Qa'im in 1056. Abu Talib Muhammad Tughril recognized only the spiritual authority of the caliph Al-Qa'im while limiting his political influence over the territories Tughril controlled, especially in light of his significant accomplishments: ending the Buyid state’s dominance over Arab Iraq, suppressing local rebellions and bandit groups, and resisting the growing influence of the Shia Fatimids in the region. In accordance with the political doctrine followed by Tughril and his advisers, the caliph’s spiritual status was acknowledged, but his interference in matters of governance was not tolerated; all executive and administrative power was to remain within the sultan’s domain. From this perspective, their policy aimed at diminishing and restricting the temporal authority of the caliph. For example, determining the caliph’s material entitlements and preventing him from exercising control over the Muslim public treasury (bayt al-mal) were among the measures taken in this framework.

To further reinforce the revival of the Abbasid caliphate and secure a future military presence in the region, Tughril requested revenues from certain areas after restoring the caliph to Baghdad. He tasked his adviser, Amid al-Mulk al-Kunduri, with delivering this request. Amid al-Mulk prepared for the mission and set out to appear before the caliph. On the way, he encountered the caliph’s vizier, Abu’l-Qasim ibn Muslimah, who was also carrying a message requesting financial assistance from Tughril. They proceeded together to Tughril’s presence and explained the situation. Realizing that Amid al-Mulk had prior knowledge of the matter, Tughril entrusted him with the management of the issue. Based on the legal codes of Baghdad, Amid al-Mulk established the financial entitlements and limitations of the caliph. As a result, the caliph became increasingly dependent on Tughril’s will and was compelled to comply with his demands following this incident.

Reign and relations with Tughril The significance of relations with the Abbasid caliphate was evident to the Seljuks even before their full integration into the Islamic world. Their early actions demonstrate the value they placed on this relationship. For instance, in a letter addressed to the governor of Syria, the Seljuk commanders referred to themselves as “slaves of the Commander of the Faithful.” After the conquest of Nishapur, when the caliph requested that the city not be plundered, Tughril paid forty thousand dinars to his brother Chaghri Beg to prevent the looting and thus secured the caliph’s satisfaction. Following their victory at the Battle of Dandanaqan, the Seljuks sent a letter to the caliph explaining their situation and seeking formal recognition of their authority—clearly indicating their desire for legitimacy from the caliph. In 1055, with Tughril’s entry into Baghdad and the end of Buyid rule, the Seljuks emerged as the principal political force at the center of the Abbasid caliphate. However, unlike their Shi‘i Buyid predecessors, they did not overtly alter the framework of relations with the caliphate. Though some differences can be observed under the reign of later rulers, the need for the caliph’s spiritual legitimacy remained. As with earlier regimes, the Seljuks ensured the legality of their rule through the caliph’s formal approval and the delivery of the Friday sermon (khutba) in their names. Due to his spiritual prestige and influence over the Sunni population, the caliph was regarded as the final arbiter of legitimacy—a status that even the Shi‘i Buyids had to acknowledge. The Seljuks adhered to this principle as well. For example, the way Tughril approached the caliph and conducted their relations closely resembled the behavior of the Buyid ruler Adud al-Dawla. Tughril’s marriage alliance with the caliph—by giving his niece in marriage—was also a symbolic union between religious and political authority. However, a significant departure in Tughril’s conduct was his proposal to marry the caliph’s own daughter. Initially, the caliph opposed this union, but under the pressure of Tughril’s military and political power, the marriage ultimately took place.

Reign and Marriage of his daughter with Tughril Tughril’s wife died in the city of Zanjan and was buried in Rayy. Following this event, Tughril instructed Abu Sa‘id, who had been sent to Rayy, to convey to the caliph his desire to marry either his daughter or his sister. Although sources differ on the precise details of this episode, there is general agreement that the caliph initially opposed this request.

This opposition stemmed from the unprecedented nature of a caliphal daughter being married to a sultan—a situation without prior example. Upon hearing of the proposal, the caliph became angered and, through his envoy Abu Muhammad al-Tamimi, offered Tughril two options: either abandon the marriage proposal, send the caliph 300,000 dinars, and surrender the revenues of Wasit and its surrounding areas; or forget the idea of marriage altogether. At first, Tughril decided to reject the offer. However, as al-Kunduri informed him, such a refusal might be interpreted as a sign of weakness. Consequently, Tughril opted to formally accept the caliph’s proposal.

To this end, al-Kunduri, accompanied by Arslan Khatun—the wife of the caliph—went to the caliphal court, carrying numerous gifts and ornaments. After presenting Tughril’s gifts, Arslan Khatun informed the caliph that Tughril had accepted some of his conditions, while rejecting others. The caliph, displeased by this selective acceptance, chose not to respond and expressed his dissatisfaction. He even threatened to leave Baghdad if Tughril did not abandon the marriage proposal. At this point, the caliph ordered that his camp be relocated to the Nahrawan region. Nevertheless, senior figures at court warned the caliph of the potential consequences of such an action. The vizier Ibn Daris hosted a banquet for al-Kunduri in an attempt to defuse the tension.

The caliph’s displeasure arose mainly from Arslan Khatun's report that Tughril had not fully accepted the caliph’s conditions. After al-Kunduri failed to appease the caliph, Tughril departed for Hamadan. Upon learning of the situation, he wrote to the elders of the caliphate, complaining about the caliph’s lack of gratitude for his services. He also requested the return of his niece Arslan Khatun, who had been married to the caliph. Following this, al-Kunduri halted the payment of salaries to the caliph’s household. As a result, the caliph was forced to concede and approved Tughril’s marriage proposal under pressure. He sent a letter granting permission for the marriage.