The Battle of Dayr al-Aqul was fought on 8 April 876, between forces of the Saffarid ruler Ya'qub ibn Laith and the Abbasid Caliphate. Taking place some 80 km southeast (downstream) of Baghdad, the battle ended in a decisive victory for the Abbasids, forcing Ya'qub to halt his advance into Iraq.
The town of (, ; literally "monastery at the river-bend", from a Syriac ʿ "bend") was the main town of the fertile district () in central Nahrawan, making it the most important town on the Tigris between Baghdad and Wasit. The battle itself took place near a village of the town's district, called Istarband, between Dayr al-Aqul itself and Sib Bani Kuma.
Background
Ever since the assassination of the caliph al-Mutawakkil in 861, the Abbasid Caliphate had been in a state of turmoil (the "Anarchy at Samarra"). The Turkish military establishment, in an effort to preserve the power of its leaders, began to overthrow any caliph whom they considered unsatisfactory. Between the death of al-Mutawakkil and the ascension of al-Mu'tamid in 870, three caliphs met violent ends. With the Turks exercising unprecedented control over the empire while the finances of the caliphate were increasingly unable to support them, the prestige of the caliphs reached its lowest point thus far.
As the situation in the capital declined, various groups in different parts of the empire took advantage of this period of weakness. In Tabaristan a Zaydi dynasty came to power in 864. In 868 the Turk Ahmad ibn Tulun gained control of Egypt and gradually asserted his independence from Samarra. In Lower Iraq and Khuzistan, the Zanj Rebellion began in 869 and posed a serious threat to the Abbasid Caliphate in the region.
In Iran, meanwhile, the most significant threat against the caliphate came in the form of the Saffarid Ya`qub bin Laith. Ya`qub first came to power in 861 in Sistan, a province which had been held by 'ayyār bands since 854. From there he rapidly expanded, and in 873 he extinguished the rule of the Tahirids, who were governors loyal to the Abbasids, in Khurasan. This left him in control of much of eastern and central Iran plus parts of Afghanistan.
Back in Samarra, reconciliation between the Turks and the caliphs had begun during the reign of al-Mu'tamid (870–892). Al-Mu'tamid's brother, al-Muwaffaq, was the driving force behind this success; he had good relations with the Turkish leaders such as Musa bin Bugha and he gradually gained more and more power until he was the actual administrator of the empire. Musa bin Bugha held the governorships of several of the eastern provinces, but his failure to make any headway against the rebels caused him to resign from these governorships in frustration, after which al-Muwaffaq took over the positions.
The Abbasids were concerned about the threat the Saffarids posed, especially after Ya`qub conquered Fars from Muhammad bin Wasil in 875. From Fars Ya`qub moved on to Khuzistan, taking possession of Ramhurmuz in December of 875. This move put the Saffarid army close to Iraq. It also put Ya`qub close to the Zanj revolt; the Abbasids feared that the Saffarids and Zanj would band together against the caliphate, although Ya`qub's later rejection of an offer by the Zanj to become allies casts doubt on this possibility. In any case it was an alarming development, as the caliph did not feel that he had the resources to stop Ya`qub. All of Ya`qub's supporters in Baghdad, who had been imprisoned in 873 following his conquest of Khurasan, were released, and al-Mu'tamid sent an embassy to Ya`qub to grant him the governorships of Khurasan, Tabaristan, Fars, Gurgan, and Ray, as appoint him as head of security in Baghdad.
Ya`qub, sensing that the offer was made due to the weakness of the caliph, rejected it and wrote back that he would be advancing to the capital. The offer also alienated the Turks of Samarra, who felt that Ya`qub represented a threat to their interests. Seeing that an agreement with the Saffarid was impossible, al-Mu'tamid decided upon war and pronounced a formal curse upon Ya`qub. On March 7, 876 he left Samarra, leaving his son al-Mufawwad in charge of the capital. On March 15 he arrived at Baghdad, before arriving near Kalwadha and setting up camp. From there his army marched to Sib Bani Kuma, where al-Mu'tamid's general Masrur al-Balkhi joined him after slowing down Ya`qub's army (see below). While there the caliph gathered more troops to his side.