Qarmatian invasion of Iraq
The Qarmatian invasion of Iraq was a large-scale raid by the Qarmatians of Bahrayn against the Abbasid Caliphate's metropolitan region of Iraq, that began in autumn of 927 and continued until the summer of 928. The invasion was the culmination of a series of destructive raids against the Hajj caravans, and the sack of Basra and Kufa, during the previous years. Coming amidst a general political malaise in the Abbasid government, which appeared helpless to counter the Qarmatians, these attacks exacerbated the political tensions in Baghdad, leading to the downfall and execution of the vizier Ibn al-Furat. In October/November 927, the Qarmatian leader, Abu Tahir al-Jannabi, led a force of no more than 2,300 men to invade Iraq. In December, the Qarmatians captured Kufa and routed the much larger army of the semi-autonomous emir of Adharbayjan, Yusuf ibn Abi'l-Saj, who was captured. The Qarmatians then began to advance north along the Euphrates towards Baghdad, where a widespread panic broke out. An army of over 40,000 men was assembled to meet the threat, but the Abbasid commanders, Mu'nis al-Muzaffar and Abu'l-Hayja al-Hamdani, preferred to avoid combat and instead obstruct the Qarmatian advance by destroying the bridges and canals near the Abbasid capital. The resulting flooding brought the Qarmatian advance to a halt at the outskirts of the city on 7 January 928. The Qarmatians then withdrew again across the Euphrates and marched up the river into Upper Mesopotamia, plundering the region and securing ransom from its cities. Unopposed, the Qarmatians withdrew to their homes in the summer of 928. Their presence had led to uprisings by sympathizers, the so-called Baqliyya, in the Sawad of Kufa, but these were suppressed by the Abbasid authorities. The survivors of these uprisings joined the Qarmatians in their retreat to Bahrayn. In the aftermath of the invasion, the Qarmatians sacked Mecca in January 930 and captured Oman in the same year, but internal troubles halted their advance. A young Persian who had been taken prisoner in Iraq, Abu'l-Fadl al-Isfahani, was recognized as the Mahdi by Abu Tahir, and power passed to him. His erratic behaviour, however, quickly made clear that he was not the millennialist figure expected by the Qarmatians, and he was murdered. The event demoralized the Qarmatians, who after that sought peaceful relations with the Abbasids. Nevertheless, the invasion of 927–928 severely deteriorated the financial and political situation in the Abbasid Caliphate, which descended into a vicious circle of military coups and internecine warfare among warlords, culminating in 946 with the takeover of Iraq by the Buyid dynasty. Background

Origins of the Qarmatians of Bahrayn
In the 880s and 890s, the Isma'ili Shi'a missionary Abu Sa'id al-Jannabi had established a strong following among the Bedouin tribes of Bahrayn. In 899, the Isma'ili movement split between a branch that followed the leadership of the future Fatimid caliph, Abdallah al-Mahdi, and those who rejected his claims to the imamate, known as the "Qarmatians". Whether out of genuine conviction or political expediency, Abu Sa'id sided with the latter faction. Allied with the local Bedouin tribes of the Banu Kilab and Banu Uqayl, as well as with the Persian Gulf merchants, Abu Sa'id was able to capture the region's capital, and in 900 cemented its independence by defeating an Abbasid army sent to recover control of Bahrayn. Under Abu Sa'id's rule, the Qarmatians of Bahrayn remained uninvolved in the unsuccessful Isma'ili uprisings of the 900s against the Sunni Abbasid Caliphate in Syria and Iraq, or in the establishment of the Fatimid Caliphate in Ifriqiya. Apart from a raid against Basra in 912, they also retained peace with the Abbasids, secured through donations of money and weapons sent by the Abbasid vizier, Ali ibn Isa ibn al-Jarrah. Abu Sa'id was assassinated in 913/4, and succeeded, at least nominally, by all of his sons collectively. The oldest, Abu'l-Qasim Sa'id al-Jannabi, was at first the pre-eminent, but his reign was brief; he was replaced by the more ambitious and warlike youngest son, Abu Tahir al-Jannabi, in 923. Qarmatian sack of Basra
Under the leadership of the barely 16-year-old Abu Tahir, the Qarmatians began raids against the Abbasid Caliphate with a surprise attack on Basra on the night of 11 August 923. The city was thoroughly plundered over the next 17 days, until the Qarmatians left, unmolested, and with an enormous train of booty and slaves. The start of hostilities was likely connected to the deposition of Ali ibn Isa from the vizierate, and his replacement by his more hawkish rival, Ibn al-Furat, who favoured military action. Upon news of the attack, Ibn al-Furat sent troops to Basra, but they arrived after the Qarmatians had left. This would be a common theme in the Abbasid military response to the Qarmatian raids: the Qarmatian raiding parties were small, but highly mobile, ensuring that any Abbasid military response would come late. At the same time, the Qarmatian base in Bahrayn was safe from Abbasid retaliation. Despite the alarming sack of Basra, Ibn al-Furat was more concerned with securing his own position than making military preparations; indeed, to remove his most powerful rival from Baghdad, he sent the commander-in-chief, Mu'nis al-Muzaffar, with his army to Raqqa, in virtual exile. At the same time, Ibn al-Furat's son, al-Muhassin, engaged in a campaign of torture against officials, in order to extract money from them. Raids on the Hajj caravans and the fall of Ibn al-Furat
In March 924, the Qarmatians destroyed the Hajj caravan making its way back from Mecca to Baghdad, taking many notables of the Abbasid court captive. As pro-Shi'a sympathizers flocked to Bahrayn, the Abbasid government, divided by factional rivalries and incapacitated by lack of funds, failed to respond effectively to the Qarmatian threat. The destruction of the Hajj caravan was a testament to the incompetence of the Abbasid government to ensure one of its most fundamental duties. Riots broke out in the streets of Baghdad against Ibn al-Furat, who now lost any support he might have had. Mu'nis was recalled to Baghdad in June, and the military commanders insisted on the deposition of Ibn al-Furat. On 16 July the vizier was deposed and executed, along with his son al-Muhassin. The event marked the final ascendance of the military over the civilian bureaucracy, with dire consequences for the future. The Hajj caravan of the next year was attacked on its way to Mecca, and despite an escort of 6,000 men had to turn back to Kufa pursued by the Qarmatians, taking heavy losses. The Qarmatians demanded the surrender of Basra and of Khuzistan, and when they were refused, they entered Kufa and pillaged it for seven days. Even the city's iron gates were dismantled and taken back to Bahrayn. In the next Hajj season, in January 926, a strong military escort ensured the safety of the pilgrims, but the authorities nevertheless paid a hefty sum to the Qarmatians to be allowed through. During the following Hajj, the caravan had to be called off entirely as the Abbasid government lacked the funds to provide the escort, and panic spread in Mecca as its inhabitants deserted the city in anticipation of a Qarmatian attack that never came. Abbasid preparations and the recall of Ali ibn Isa
In the meantime, the Abbasid government made frantic efforts to gather money for recruiting more soldiers, but the two short-lived viziers who followed Ibn al-Furat, Abdallah al-Khaqani and Ahmad al-Khasibi, were unable to shore up the state's finances. Matters were made worse by persistent rumours that elements in the Abbasid government were secretly in league with the Qarmatians, a charge that was liberally levelled at political opponents at the time. In desperation, in 926 the vizier al-Khasibi called upon the semi-autonomous, hereditary Sajid emir of Adharbayjan and Armenia, Yusuf ibn Abi'l-Saj, with his troops, to confront the Qarmatian menace. As the treasury was empty, the revenues of the eastern provinces still under Abbasid control (the Jibal and northwestern Persia), along with Ibn Abi'l-Saj's own domains, were allocated for the upkeep of his army. As the historian Hugh Kennedy remarks, this was a "foolish idea": the Sajid troops, mostly highland troops, were unaccustomed to fighting in the desert plains of Iraq, while Ibn Abi'l-Saj's loyalty to Baghdad was questionable and contingent on being paid the promised sums. Finally, in April 927, Ali ibn Isa was recalled to the vizierate at the insistence of Mu'nis, to lead a sort of 'national unity government' to deal with the crisis. Ali ibn Isa favoured an alternative solution, namely recruiting troops from the Bedouin tribes of Asad and Shayban, which would cost the treasury far less and provide better-suited troops. At the same time the vizier tried to persuade Ibn Abi'l-Saj to return to his home province, but the latter refused, just as he refused to lead his men into the field before the promised money arrived. In the meantime the Sajid troops made their base at Wasit, from where they oppressed the local population. Invasion

Fall of Kufa and defeat of the Sajid army
All of Ali ibn Isa's plans would take time to implement, however, and that was running out. In October/November 927, the Qarmatians under Abu Tahir launched their invasion of Iraq, moving to attack Kufa. Mu'nis was recalled from a campaign against the Byzantine Empire, large stores of weapons and supplies set up at Kufa, and Ibn Abi'l-Saj ordered to make for the city. The fast-moving Qarmatians reached Kufa first, however, capturing the stored supplies. The invading Qarmatian force was small—medieval sources put it at between 1,500 and 2,300 men—so Ibn Abi'l-Saj decided to attack them. Despite enjoying considerable numerical superiority, in a battle near Kufa on 7 December 927, the Sajid troops were defeated and Ibn Abi'l-Saj himself captured. Hidden Isma'ili sympathizers (the Baqliyya) in the Sawad of Kufa revealed themselves and rose in revolt, from the Bedouin tribes of Rifa'a, Dhuhl, and Abs, to the nephew of the early Isma'ili missionary Abu Muhammad Abdan, who seized control of Kufa and declared the end of the Abbasid dynasty and the imminent arrival of the Islamic messiah, the Mahdi. The rebels were soon dispersed by Abbasid troops from Wasit under Harun ibn Gharib, but their remnants joined Abu Tahir's forces. Qarmatian march on Baghdad and the Abbasid response
After their victory at Kufa, the Qarmatians began their advance north, targeting Baghdad itself. As the Qarmatians advanced, panic broke out in Baghdad, where many feared that the city would fall and the Abbasid Caliphate perish, as rumours spread that Abu Tahir had already divided the caliphal palaces among his followers. The Abbasid government mobilized even its palace troops, which rarely left the capital, to meet the threat. Ali ibn Isa was obliged to turn to the queen mother, Shaghab, for money to enlist the boatmen of Baghdad into government service. In the meantime, the Qarmatians reached Anbar on 14 December, finding the bridge over the Euphrates destroyed. Some men in boats managed to cross the river and repair it, allowing the rest of the army to cross, but leaving their baggage train behind on the west bank. During the night, the Abbasids managed to burn down the bridge again, stranding the Qarmatians east of the river, but the latter nevertheless continued their march on the Abbasid capital. The couple of thousand of Qarmatians faced an army of over 40,000 men, commanded by Mu'nis and the Hamdanid chieftain Abu'l-Hayja, but the Abbasid troops were of low quality and represented the result of an emergency mass mobilization rather than a trained military force. According to Kennedy, the actual number of effective, regular troops available to the Abbasid government at the time was probably  well below 10,000 men, and that only in emergencies. As a result, instead of confronting the Qarmatians in the field, Mu'nis resorted to breaching the canals, flooding the fields, and tearing down the bridges leading to Baghdad to halt the Qarmatian advance. Finding their way blocked, on 7 January 928, at the tell of Aqarquf, within sight of the towers of Baghdad, the Qarmatian advance was halted. While the Qarmatian army was still east of the Euphrates, the Abbasids planned to attack their camp on the west bank, and free Ibn Abi'l-Saj. For this purpose, Mu'nis detailed his chamberlain Yalqbaq with 6,000 men, most of whom appear to have been Sajid troops. Abu Tahir suspected their intentions and managed to cross the river at night, to alert his camp and prepare its defence. The Abbasid attack failed, and Ibn Abi'l-Saj was executed in the aftermath. Qarmatian raid into Upper Mesopotamia
The Qarmatian army managed to cross the Euphrates, but despite being thwarted in their attack on Baghdad, Abu Tahir did not give up. His men followed the river to the north into Upper Mesopotamia, plundering as they went. The town of Hit resisted their attacks, but they sacked al-Daliya, al-Rahba, and reached Raqqa, which they also assaulted unsuccessfully. Smaller Qarmatian bands ranged as far as Ras al-Ayn and Sinjar, extracting ransoms from the cities and plundering the countryside. As Kennedy remarks, the Abbasid government's policy of concentrating its troops in the capital meant that cities across the Caliphate were left to their own devices, forced to hastily improvise defences and raise militias to fend off the attackers. Finally, in the summer of 928, the Qarmatians retreated to their homes in Bahrayn, with Abu Tahir leaving behind a poem in which he promised to return. Aftermath

Sack of Mecca and the end of Qarmatian expansion
Abu Tahir made good on his threat by attacking Mecca itself in January 930, during the Hajj. They massacred the Hajj pilgrims, desecrated the Zamzam Well by throwing in corpses and plundered the Kaaba, taking its relics, including the Black Stone, with them to their capital al-Ahsa. This event may have been connected to internal developments in the Qarmatian state: on his return from Iraq, Abu Tahir recognized one of the captives brought with them, a young Persian named Abu'l-Fadl al-Isfahani, taken at Qasr Ibn Hubayra, as the awaited Mahdi. He was proclaimed as such publicly in 931, with full power being ceded into his hands by the Qarmatian leaders. As the Mahdi was expected to annul the existing religious law of Muhammad and announce a new and final revelation, the unprecedented desecration of Mecca was likely tied with the millennialist expectations associated with their new messiah among the Qarmatians. In the event, the bizarre and autocratic behaviour of the supposed Mahdi, who was worshipped as a living god and had several leading Qarmatians executed, aroused resistance, and he was murdered soon after. Abu Tahir was able to retain power over Bahrayn, and the Qarmatian leadership denounced the entire episode as an error and reverted to its previous adherence to Islamic law. Nevertheless, the affair of the false Mahdi tarnished the prestige of Abu Tahir and shattered the morale of the Qarmatians, many of whom abandoned Bahrayn to seek service in the armies of various regional warlords. At the same time, the event evidently checked Abu Tahir's ambitions: after conquering Oman in 930, he seemed poised to repeat his invasion of Iraq, but after a sack of Kufa in 931, he returned with his men back to Bahrayn to deal with the false Mahdi. Over the following years, the Qarmatians of Bahrayn entered into negotiations with the Abbasid government, resulting in the conclusion of a peace treaty in 939, and eventually the return of the Black Stone to Mecca in 951. These events marked, in the words of Hugh Kennedy, "the assimilation of the Qarmati state into the Muslim political order". Decline and collapse of the Abbasid Caliphate
In the Abbasid Caliphate, the disastrous Qarmatian invasion of Iraq, which left the once fertile Sawad devastated, exacerbated the political infighting in Baghdad. Once the immediate danger had passed, the court secured Ali ibn Isa's dismissal in May 928, and the intrigues and power struggles resumed, this time between Mu'nis and Harub ibn Gharib. The disputes resulted in the brief deposition of Caliph al-Muqtadir in February 929, but even though the caliph was restored within days, the following years were a period of coups and counter-coups that culminated in the overthrow and death of al-Muqtadir by Mu'nis in 932. Rather than stabilizing the situation, this merely highlighted the role that the military could play in court politics. In the following decades, a number of military strongmen and regional warlords fought one another for control of Baghdad and the now virtually powerless caliphs and the revenues of Iraq, until the final takeover of Baghdad by the Buyid dynasty in 945. Footnotes

References

Sources
 
 
 
 
 
 

927
928
920s conflicts
Battles involving the Qarmatians
Wars involving the Abbasid Caliphate
10th century in the Abbasid Caliphate
10th century in Iraq
Invasions of Iraq
History of Ismailism
Rebellions against the Abbasid Caliphate