Abū Muḥammad ʿAlī ibn Aḥmad ibn Ṭalḥa ibn Jaʿfar ibn Muḥammad ibn Hārūn al-Muktafī bi'Llāh (; 877/78 – 13 August 908), better known by his regnal name al-Muktafī bi-Llāh (), was the caliph of the Abbasid Caliphate from 902 to 908. More liberal and sedentary than his militaristic father al-Mu'tadid, al-Muktafi essentially continued his policies, although most of the actual conduct of government was left to his viziers and officials. His reign saw the defeat of the Qarmatians of the Syrian Desert, and the reincorporation of Egypt and the parts of Syria ruled by the Tulunid dynasty. The war with the Byzantine Empire continued with alternating success, although the Arabs scored a major victory in the Sack of Thessalonica in 904. His death in 908 opened the way for the installation of a weak ruler, al-Muqtadir, by the palace bureaucracy, and began the terminal decline of the Abbasid Caliphate that ended in 946 with the caliphs becoming puppet rulers under the Buyid dynasty.

Early life Ali ibn Ahmad was born in 877/8, the son of Ahmad ibn Talha, the future caliph al-Mu'tadid () by a Turkish slave-girl, named Čiček ("flower", Jijak in Arabic). He was the first caliph named after caliph Ali.

At the time of his birth, the Abbasid Caliphate was still reeling from the decade-long civil war known as the "Anarchy at Samarra", which had begun with the assassination of Caliph al-Mutawakkil () by dissatisfied soldiers and ended with the accession of al-Mu'tamid (). Real power, however, lay with al-Mu'tamid's brother, al-Muwaffaq, Ali's paternal grandfather. Al-Muwaffaq enjoyed the loyalty of the military, and by 877 had established himself as the de facto ruler of the state. Caliphal authority in the provinces collapsed during the "Anarchy at Samarra", with the result that by the 870s the central government had lost effective control over most of the Caliphate outside the metropolitan region of Iraq. In the west, Egypt had fallen under the control of Ahmad ibn Tulun, who also disputed control of Syria with al-Muwaffaq, while Khurasan and most of the Islamic East had been taken over by the Saffarids, who replaced Abbasids' loyal clients, the Tahirids. Most of the Arabian peninsula was likewise lost to local potentates, while in Tabaristan a radical Zaydi Shi'a dynasty took power. In Iraq, the rebellion of the Zanj slaves threatened Baghdad itself, and it took al-Muwaffaq and al-Mu'tadid years of hard campaigning before they were finally subdued in 893.

Following his rise to the throne, al-Mu'tadid continued his father's policies, and restored caliphal authority in the Jazira, northern Syria, and parts of western Iran. He established an effective administration, but the incessant campaigning, and the need to keep the soldiery satisfied, meant that it was almost totally geared towards providing the funds necessary to maintain the army. Nevertheless, al-Mu'tadid managed to accumulate a considerable surplus in his ten-year reign. At the same time the bureaucracy grew in power, it also saw a growth in factionalism, with two rival "clans" emerging, the Banu'l-Furat and the Banu'l-Jarrah. The two groups represented primarily different factions in a struggle for office and power, but there are indications of "ideological" differences as well: many of the Banu'l-Jarrah families hailed from converted Nestorian families and employed Christians in the bureaucracy, in addition to maintaining closer ties with the military, while the Banu'l-Furat tried to impose firm civilian control of the army and (not quite openly) favoured Shi'ism.

Al-Mu'tadid took care to prepare Ali, his oldest son and heir-apparent, for the succession by appointing him as a provincial governor: first in Rayy, Qazvin, Qum and Hamadan, when these provinces were seized from the semi-autonomous Dulafid dynasty in , and in 899 over the Jazira and the Byzantine frontier areas, when al-Mu'tadid deposed the last local autonomous governor, Muhammad ibn Ahmad al-Shaybani. The future al-Muktafi took up residence at Raqqa. The religious scholar Ibn Abi al-Dunya, who enjoyed al-Mu'tadid's confidence, was appointed as Ali's tutor.

Caliphate When al-Mu'tadid died on 5 April 902, al-Muktafi succeeded him unopposed. His father's vizier, al-Qasim ibn Ubayd Allah, ordered the oath of allegiance to be taken in his name, and took the precaution of locking up all Abbasid princes until al-Muktafi arrived in Baghdad from Raqqa (20 April).

Character and government

The new caliph was 25 years old on his accession. The historian al-Tabari, who lived during his reign, describes him as of "medium size, handsome, of a delicate complexion, with [a full head of] beautiful hair and a luxurious beard".

Al-Muktafi inherited his father's love of buildings. He completed al-Mu'tadid's third palace project, the Taj ('Crown') Palace, in Baghdad, for which he reused bricks from the palace of the Sasanian rulers in Ctesiphon. Among its numerous buildings was a semicircular tower, known as the 'Cupola of the Ass' (). The caliph could ride to its top mounted on a donkey, and from there gaze on the surrounding countryside. On the site of his father's palace prisons, he also added a Friday mosque to the palace, the ('Palace Mosque'), now occupied by the . He also emulated his father in avarice and parsimony, which allowed him to leave, despite a short reign with almost continuous warfare, a considerable surplus. When al-Muktafi left Baghdad in May 903 and went to the old capital of Samarra, with the intention of moving his seat there, he was quickly dissuaded by the high cost the rebuilding of the city would entail. His easy-going nature, on the other hand, was the antithesis of his father, who was famous for his extreme severity and the cruel and imaginative punishments he inflicted. Al-Muktafi's popularity received a major boostr when, soon after his accession, he destroyed his father's underground prisons and gave the site to the people, released prisoners and returned lands confiscated by the government. He is also notable for personally attending the sessions of the , where he heard the complaints and petitions of the common people.

Role of the vizier al-Qasim Al-Muktafi was not as steadfast as his father, and was easily swayed by the officials at court. The early period of his caliphate was dominated by the vizier al-Qasim ibn Ubayd Allah. A very able man, he was also ambitious; he had plotted to assassinate al-Mu'tadid shortly before the latter's death, and now ruthlessly eliminated any rivals for influence over the new caliph.

Thus al-Qasim ordered the execution of the imprisoned Saffarid ruler, Amr ibn al-Layth, when al-Muktafi, immediately after his arrival in Baghdad, asked after his well-being and indicated that he wanted to treat him well. Shortly after, the vizier managed to discredit al-Mu'tadid's loyal commander-in-chief, Badr al-Mu'tadidi. Badr was forced to flee Baghdad but surrendered after being promised a pardon by the vizier's agents, only to be executed on 14 August. A few days later, al-Qasim ordered the arrest of an uncle of the Caliph, Abd al-Wahid, a son of al-Muwaffaq, who never heard from again; and in September 903, al-Husayn ibn Amr al-Nasrani, a Christian secretary, whom al-Muktafi initially favoured and who opposed al-Qasim, was denounced and exiled, his offices being given to al-Qasim's sons, al-Husayn and Muhammad. Al-Qasim even succeeded in having his little daughter betrothed to al-Muktafi's infant son Abu Ahmad Muhammad in March 904, and his eminent position in the state was highlighted by the award, for the first time in the Islamic world, of a special honorific title, .

In the bureaucratic struggles of the period, al-Qasim ibn Ubayd Allah favoured the Banu'l-Jarrah and resisted the pro-Shi'ite leanings of the Banu'l-Furat. The leading representative of the Banu'l-Furat, Abu'l-Hasan Ali ibn al-Furat, only escaped death due to the vizier's own death in 904. Before his death al-Qasim had nominated as his successors either al-Abbas ibn al-Hasan al-Jarjara'i or Ali ibn Isa al-Jarrah, but the latter refused the post, and Ali ibn al-Furat quickly gained the favour of al-Abbas al-Jarjara'i and the Caliph.

Campaigns Al-Muktafi's brief reign was dominated by warfare, but he was unlike his father, the " caliph" par excellence. Al-Mu'tadid had actively participated in campaigns, setting a personal example and allowing for the formation of ties of loyalty, reinforced by patronage, between the ruler and the soldiers. Al-Muktafi, on the other hand, did not "in his character and comportment [...], being a sedentary figure, instill much loyalty, let alone inspiration, in the soldiers", according to the historian Michael Bonner.

Relations with the eastern warlords Al-Mu'tadid had had a turbulent relationship with the Saffarids, who ruled most of Persia: their rule over the eastern parts of the Islamic world was recognized by Baghdad, but the caliph and the Saffarids contested control over western Persia, notably the provinces of Fars and Kirman. In 901, the Saffarids had seized Fars, and repulsed Badr al-Mu'tadidi's attempts to recover it. At the time of al-Muktafi's accession, the Saffarids captured Rayy. A military response was delayed by the affair around Badr al-Mu'tadidi, and it was not until 5 November that troops were sent to the region. The result of the expedition is unknown, however, and it is known that the Samanids captured Rayy in the same year. Like his father before him, al-Muktafi preferred to reach a modus vivendi with the Saffarids, and in the next year confirmed them in their control over Fars.

Baghdad's relations with the quasi-independent ruler of Adharbayjan, Yusuf ibn Abi'l-Saj, had never been settled and became increasingly strained under al-Muktafi. In 908, an army under Hakam al-Muflihi was sent against Ibn Abi'l-Saj, but after al-Muktafi's death soon after, a settlement was reached: Ibn Abi'l-Saj acknowledged caliphal suzerainty and was named governor of Armenia and Adharbayjan.

Qarmatian uprisings