Battle of Hama

The Battle of Hama was fought some from the city of Hama in Syria on 29 November 903 between the forces of the Abbasid Caliphate and the Qarmatians. The Abbasids were victorious, resulting in the capture and execution of the Qarmatian leadership. This weakened the Qarmatian presence in northern Syria, which was finally eradicated after the suppression of another revolt in 906. More importantly, it paved the way for the Abbasid attack on the autonomous Tulunid dynasty and the reincorporation of the Tulunid domains in southern Syria and Egypt into the Abbasid Caliphate.
Background.
The Qarmatians were a radical Isma'ili Shi'ite sect founded in Kufa around 874 by a certain Hamdan Qarmat. They denounced mainstream Sunni Islam for practices they viewed as deviations from the true teachings of the religion, such as the "hajj" and the worship of the Kaaba, as well as the dwelling in cities and the marginalization of the Bedouin. Consequently, as they gained adherents, the Qarmatians began assaulting the neighbouring Muslim communities. Originally a sporadic and minor nuisance in the Sawad, their power grew swiftly to alarming proportions after 897, when they launched a series of uprisings against the Abbasid Caliphate. In this period, the Isma'ili movement was based at Salamiya on the western edge of the Syrian Desert, and its leadership was assumed by Sa'id ibn al-Husayn, the future founder of the Fatimid Caliphate. Sa'id's claims to be the awaited Mahdi caused a split in the movement in 899. The majority, including Hamdan Qarmat, rejected the Fatimid claims and left to continue their proselytization elsewhere.
The missionary efforts of the Qarmatian movement were redirected beyond the Sawad and quickly bore fruit. Under the leadership of Abu Sa'id al-Jannabi, they seized Bahrayn in 899 and in the next year defeated a caliphal army under al-Abbas ibn Amr al-Ghanawi. Independently of al-Jannabi, another base was established in the area around Palmyra by the missionaries Yahya ibn Zikrawayh, known by the name Sahib al-Naqa ("Master of the She-camel") and al-Husayn, probably Yahya's brother, who took the name Sahib al-Shama ("Man with the Mole"). Both in Bahrayn and in Syria, the Qarmatians were able to convert many local Bedouin—the Banu Kalb in Syria and the Banu Kilab and Banu Uqayl in Bahrayn—to their cause, thus acquiring a potent military force, albeit one with limitations: the Bedouin were more concerned with extracting booty from the settled communities, and were ill-suited to campaigns of conquering and holding territories. At this time, Sa'id and his followers soon left and travelled secretly to the Maghreb, where in 909 they would overthrow the ruling Aghlabids and establish the Fatimid state.
From their base in the region around Palmyra, the Qarmatians began launching raids against the Abbasid and Tulunid provinces of Syria, with devastating effect. In 902, the Qarmatians defeated the Tulunids under Tughj ibn Juff near Raqqa, and laid siege to Damascus. The city was successfully held by Tughj and the Sahib al-Naqa was killed. Leadership passed to the Sahib al-Shama, who led the Qarmatians to ravage Homs, Hama, Ba'albek, Ma'arrat al-Numan, and even Salamiya, where they massacred the members of Sa'id's family that had remained there.
The motivations of al-Husayn, Yahya, and their father, Zikrawayh ibn Mihrawayh, who remained in hiding in Iraq, have been variously interpreted by modern scholars. Traditionally this movement has been regarded as wholly Qarmatian in character, and Sa'id's flight from Salamiya a reaction to the threat they posed to him. In recent years, however, the argument of Heinz Halm has prevailed, according to which Zikrawayh and his sons remained loyal to Sa'id, and their actions aimed at securing possession of Syria and triggering a general rebellion against the Abbasids. Sa'id regarded the uprising as premature, and felt that it compromised his own safety. He not only refused to join the brothers, despite their entreaties, but left Salamiya with his son and a few close supporters, first for Ramla in Palestine, and thence to Egypt and the Maghreb. It was only after this "betrayal" and the death of the Sahib al-Naqa that Salamiya was attacked by a grieving and enraged Sahib al-Shama; the movement then moved away from Fatimid loyalism and "acquired the characteristics of dissident Qarmatism".
Battle.
In view of the apparent impotence of the Tulunid regime to stop the Qarmatian raids, the Syrians called upon the Abbasid government to intervene directly, and on 30 July 903, Caliph al-Muktafi commanded that a campaign be undertaken. The campaign was nominally headed by al-Muktafi in person, who left Baghdad on 9 August and went to Raqqa. In mid-August, the Qarmatians under a certain al-Mutawwaq surprised an Abbasid army some 10,000 strong near Aleppo, while it was resting and dispersed, with many troops seeking to escape the intense heat in a local river; the Abbasid troops were routed, and only about a thousand managed to reach the city, where, under the command of Abu al-Agharr, they repulsed the Qarmatian attacks. At about the same time, however, the general Badr al-Hammami inflicted a heavy defeat on the Sahib al-Shama and his men near Damascus. The Qarmatians fled to the desert, and Caliph al-Muktafi sent men under al-Husayn ibn Hamdan to pursue them. While al-Muktafi remained at Raqqa, command of the army in the field was given to the head of the department of the army ("dīwān al-jund"), Muhammad ibn Sulayman al-Katib. On Tuesday, 29 November 903, the Abbasid army under Muhammad met the Qarmatians at a location some 24 km from Hama. The course of the battle is described in a victory dispatch sent by Muhammad to the caliph afterwards and included in the "History of the Prophets and Kings" of al-Tabari. 
According to the latter, on the morning of 29 November, the Abbasid army set out from al-Qarwanah towards al-Alyanah—both unidentified locations—deployed in full battle order. During the march, Muhammad ibn Sulayman received a report that a part of the Qarmatian army, comprising 3,000 horse and many foot under one of the chief missionaries ("dā'ī"), al-Nu'man, had encamped at a locality some 12 Arabic miles (ca. 24 km) from Hama, and that the other detachments of the Qarmatian army had joined him there. Muhammad led his army towards the Qarmatian encampment, and found them deployed in battle array. According to the report of Muhammad, the Qarmatian left wing was led by Masrur al-Ulaymi and others, in charge of 1,500 horsemen. Behind the left wing was placed a reserve force of 400 cavalry. The Qarmatian centre was commanded by al-Nu'man al-Ullaysi and other officers, and comprised 1,400 cavalry and 3,000 infantry, while the right wing was commanded by Kulayb al-Ullaysi and others and numbered 1,400 horsemen, with a reserve force of 200 horsemen more.
As the two armies advanced on each other, the Qarmatian left thrust forward against the Abbasid right, which was commanded by al-Husayn ibn Hamdan. The troops of Ibn Hamdan repulsed the first Qarmatian attack, and then the second, killing 600 horsemen. The Qarmatians on the left broke and fled; Ibn Hamdan and his men pursued them and in a series of engagements killed all but 200 of them. Ibn Hamdan's troops reportedly captured 500 horses and 400 silver necklaces as well. The Qarmatian right wing likewise attacked the Abbasid left, held by al-Qasim ibn Sima, Yumn al-Khadim, and the tribal allies of Banu Shayban and Banu Tamim. While the two wings were grappling with each other, an Abbasid detachment under Khalifah ibn al-Mubarak and Lu'lu' attacked the Qarmatians on their flank and broke their lines. Here too the Qarmatians fled pursued by the government forces, who took some 600 horses and 200 necklaces as booty.
Muhammad himself confronted the Qarmatian centre along with several other officers: Khaqan, Nasr al-Qushuri, and Muhammad ibn Kumushjur led forces from the right flank, Wasf Mushgir, Muhammad ibn Ishaq ibn Kundajiq, Ahmad ibn Kayghalagh and his brother Ibrahim, al-Mubarak al-Qummi, Rabi'a ibn Muhammad, Muhajir ibn Tulayq, al-Muzaffar ibn Hajj, Abdallah ibn Hamdan (al-Husayn's brother), Jinni the Elder, Wasif al-Buktamir, Bishr al-Buktamiri, and Muhammad ibn Qaratughan. With the support of troops from the right wing, who after repelling the Qarmatian left flanked the Qarmatian centre, the Abbasids were victorious here as well. The Qarmatians broke and were pursued over several miles. Muhammad ibn Sulayman, fearful lest his army disperse itself during the pursuit, or leave the infantry and the baggage train—guarded by Isa ibn Muhammad al-Nushari—exposed to a Qarmatian attack, halted the pursuit of his own detachment after half a mile. He set up camp there for the night, and with the Caliph's spear as a rallying point, began regrouping the various squadrons. Despite the overwhelming victory, Muhammad and his officers remained on guard during the night, concerned of a possible Qarmatian attack. 
Several Qarmatian commanders, including the "dā'ī" al-Nu'man, were killed, while the Sahib al-Shama along with his cousin al-Muddathir, his associate al-Muttawaq and a Greek page fled through the desert, trying to reach Kufa. By the time they reached the locality of al-Daliyah on the Euphrates Road near al-Rahba, they had run out of supplies. When a servant was sent to buy provisions in the settlement, he aroused the suspicions of the villagers with his strange dress and manner, so that they notified a local official, Abu Khubzah. The latter rode out with an escort, and after interrogating the servant went to the Qarmatians' camp and took them prisoner. They captured the Sahib al-Shama and his companions were then escorted by Abu Khubzah and the local governor, Ahmad ibn Muhammad ibn Kushmard, to Caliph al-Muktafi in Raqqa, which they entered on 19 December.
Aftermath.
Al-Muktafi returned to Baghdad with the senior captives, who were thrown into prison. Muhammad ibn Sulayman remained at Raqqa to scour the countryside and round up the remaining rebels. He too then returned to Baghdad, which he entered in triumph on 2 February 904. Eleven days later, on 13 February, Muhammad and the "sahib al-shurta" of the capital, Ahmad ibn Muhammad al-Wathiqi, presided over the public execution of the Qarmatian leaders and Qarmatian sympathizers rounded up from Kufa and Baghdad. 
The Abbasid victory near Hama did not yet fully eradicate the Qarmatians from the area; in 906, the Banu Kalb, under the Qarmatian Abu Ghanim Nasr, rose up in rebellion, raided the Hawran and Tiberias, and launched a failed attack on Damascus. They then sacked Tiberias and plundered Hit on the Euphrates. Nasr was soon cornered by the caliphal army, however, and killed by the Banu Kalb themselves in exchange for pardon. As a result, the Qarmatian activities shifted east to the Euphrates, where Zikrawayh ibn Mihrawayh (the father of al-Husayn and Yahya) had also rebelled in 906 near Kufa. After leading an unsuccessful attack on Kufa and number of devastating raids on "hajj" caravans, he too was killed in early 907 by caliphal troops under Wasif ibn Sawartakin near al-Qadisiyya. With these defeats, the Qarmatian movement virtually ceased to exist in the Syrian Desert, although their counterparts in Bahrayn remained an active threat for several decades to come.
More importantly, the defeat of the Qarmatians at Hama opened the way for the Abbasids to recover the provinces of southern Syria and Egypt, held by the Tulunids. The Tulunid regime had become enfeebled due to internal strife, rivalries and the defection of senior officers, and the recent failures against the Qarmatians. In 904, Muhammad ibn Sulayman led an army into Syria. The campaign met with little opposition; the Tulunid emir Harun ibn Khumarawayh was even assassinated by his uncles, whereupon several senior commanders switched sides. The Abbasids entered the Egyptian capital Fustat in January 905 without a fight, completing the reconquest of the province.