The Zanj Revolt: A Slave War in Medieval Iraq

By Adam Ali

After generations of oppression, an army of slaves rose up to challenge the Abbasid Caliphate. 

The Zanj revolt was a major slave uprising against the Abbasid Caliphate that took place in the marshlands of Southern Iraq (al-Bata‘ih) and Southern Iran (al-Ahwaz) during the ninth century. Between the years 869-883 rebel slaves defeated several armies sent against them by the authorities, created an independent polity for themselves with a capital, al-Mukhtara, deep in the marshes, struck their own coins, and at the peak of their power expanded their territory to include all of Southern Iraq and parts of Central Iraq sacking major cities such as Basra and Wasit. It took a campaign that lasted several years and the commitment of significant military resources and personnel to finally defeat them and end the rebellion. Not since the servile wars of the Roman era had there been a slave uprising against an imperial power of the magnitude that engulfed Iraq during the Zanj rebellion.

Slavery in most of the Islamic world differed quiet significantly to its counterpart in the west. Most slaves who entered the caliphate found themselves in the urban centers of the caliphate serving in the households of merchants, dignitaries, nobles, and rulers. These slaves fulfilled a number of tasks including household chores (such as cooking, cleaning, fetching water etc.), provided skilled labor (carpenters, blacksmiths, jewelers, etc.), worked as administrators and representatives in their masters’ businesses, ran the administration of the government, served as soldiers and bodyguards, and as concubines in their harems.


Sometimes these slaves gained their freedom and became integrated into their new societies. Some were emancipated, while others were able to buy their freedom through the money they earned from their work. For example a slave working as a blacksmith was required to pay his master a fixed amount of money every week and any surpluses he earned were the wages he used to maintain himself and to eventually buy his freedom.

A scene from a 13th century manuscript, showing slaves in the Arab world. BNF MS Arabe 5847 fol.105r

Slavery was sometimes also one of the few ways for upward social mobility in the medieval Muslim world. Those slaves that served as soldiers in the retinues of sultans and caliphs could rise through the ranks to become generals, viziers, and in some cases established their own kingdoms and empires (e.g. the Ghaznavid Empire and the Mamluk Sultanate).


Concubines also rose to prominence if they were members of the royal harem. Khaizuran, al-Mahdi’s (the third Abbasid caliph) concubine, was second only to her husband when it came to wealth and power in the entire caliphate. In fact her sons, al-Hadi and Harun al-Rashid, were by their father’s to be his successors despite him having a noble freeborn Arab wife who had born him two older sons. However, such cases were relatively rare considering the huge numbers of slaves present in the Muslim world and such social mobility was only possible for the relatively few who were the slaves of a ruler or an important dignitary.

There was a close interpersonal relationship between slave and master in this form of household slavery and often close bonds were formed between them. Although there are numerous accounts of the mistreatment of slaves by their masters, it was generally in the interest of the master to treat his slaves well, or at least relatively well, and for the slaves to serve their master and to be loyal. This way both parties benefited. In fact, the Qabus Nameh (an 11th century work in the genre of Persian advice literature or mirrors for princes) advises the slave owner to sell his slave if he does not get along with him, rather than punishing him harshly. This was especially the case regarding military slaves, who were the socio-military elites of the Islamic world for a millennium between the 9th and 19th centuries. One need not think too hard on the outcome of mistreating or abusing these military slaves, who formed the elites of the militaries of the Muslim world. If they felt threatened or offended by their master, military slaves killed him and sought service under a new master or formed their own polities. Mardavij ibn Ziyar (the north Iranian condottiere and founder of the Ziyarid dynasty), Ahmad Ibn Ismail (the ruler of the vast Samanid Empire), Turanshah (the last Ayyubid sultan of Egypt), and al-Mutawakkil (the 10th Abbasid caliph) were all murdered by their slave soldiers whom they either mistreated, insulted, or threatened. Despite household slavery being the most prominent form of slavery in the Islamic world, plantation slavery, similar to that practice in the Americas during the 16th-19th centuries, was also practiced during the 9th century in Southern Iraq. As we will see below, the slaves on these plantations were treated very differently to some of the cases described above.

The Marshlands

The geography of Southern Iraq is dominated by the Euphrates and Tigris rivers and vast marshlands that result from the regular flooding of these rivers. This landscape was dominated by swampy muddy terrain covered with growths of reeds and rushes (often several meters tall) and wide but shallow canals. These canals could only be navigated using flat bottomed boats making this region very inaccessible.

The inhabitants of the marshes lived primarily as farmers. They tilled small plots of land growing rice, barley, lentils, millet, sorghum, melons, watermelons, and onions. They also kept buffalo, sheep, and cows and supplemented their diet through the abundant fish in the waters and various types of waterfowl such as gulls, wild ducks, and geese. There were also larger more dangerous animals such as wild boars, leopards, jackals, wolves, lions, lynx, and wildcats that inhabited this marshy ecosystem. But perhaps the greatest scourge to the inhabitants, and more so to outsiders, were the swarms of mosquitoes, gnats, flies, and other insects that carried diseases such as malaria.

Marsh Arabs poling a traditional mashoof in the marshes of southern Iraq. Photo by Hassan Janali, U.S. Army Corps of Engineers

Due to the inhospitable terrain, the harsh living conditions, the insects, and diseases, the population of the region went through a decline, especially after the Islamic conquests of the 7th century and the establishment of great urban centers in Iraq such as Basra, Kufa, Wasit, and Baghdad. Many of the inhabitants of the marshes migrated to these cities, which had become booming economic and intellectual centers by the 9th century, in the hope of finding work and better lives.

The marshes became abandoned dead lands due to the mass exodus of its inhabitants to the cities. The Abbasids took an interest in reclaiming this area and making it suited for agriculture. The law of the land stated that all one had to do to claim ownership of a part of these marshes was to, once again, make the land agriculturally viable. These areas had become “dead” lands because layers of natron were deposited over the topsoil due to the frequent flooding of the rivers in the region. These layers of natron had to be removed to reclaim these lands and make them agriculturally viable. Wealthy magnates and merchants, especially in the southern city of Basra, had the capital and political backing of the caliphs to claim these lands, clear them, and cultivate them using servile labor.

Large numbers of Africans, mainly Bantu speaking, from the east coast of Africa and Zanzibar were purchased or captured and transported to Southern Iraq as the main source of the manpower that was used to reclaim and cultivate the marshy regions. These slaves were the ones whom the sources refer to as the Zanj. The Zanj lived and worked in deplorable conditions. They had no direct contact with their masters, who lived in the large urban centers of Iraq. Their contact with authority was through their overseers, who were usually very harsh and cruel to the slaves. Their work was back breaking, scraping the natron layer off the top of the soil and transporting it on their backs or using mules and piling it in giant mounds in order to prepare the land for cultivation. Along with the black slaves, local peasants who had remained in the marshes were also recruited for this task. These servile laborers were grouped in crowded camps of 500 to 5,000 individuals. In addition to the hard work and cruel treatment of the overseers, the Zanj were barely provided with the basic necessities for life. They were given little to no clothing, their shelters were cramped and did little to guard them from the elements or the biting insects, and they were barely given enough food to survive. This form of slavery differs greatly from the domestic household slavery described earlier. Alexandre Popovic, the author of one of the few academic studies on this revolt, sums it up by saying: “The situation is all the more striking since slavery in Islamic countries of the Middle Ages (contrary to slavery in Rome and at the time of Spartacus) was essentially domestic servitude and not much employed for large rural projects. The conditions under which the Zanj slaves lived were unquestionably unusual for medieval Muslim society.”


The terrible living conditions and the cruelty of the overseers definitely caused a great deal of discontent and rebelliousness among the Zanj. However, it was the religion of their masters that pushed them over the edge. Through their contacts with Muslims in Iraq many of the slaves started to learn about Islam and converted to the religion. Some of the earliest adherents of Islam and the prophet Muhammad had been the slaves and the downtrodden of Meccan society due to the promise of justice, equality, and brotherhood for all who embraced the religion. In fact, one of the earliest sects of Islam, Kharijism, taught that even the lowliest of slaves could become the leader of their community based on his piety and merit. Furthermore, the Prophet’s cousin, Ali ibn Abi Talib, also championed the cause of the downtrodden and during the First Civil War (656-661) there were 8,000 slaves and freedmen in his army of 60,000. Despite the conversion of thousands of Zanj to Islam, their conditions did not improve. Their anger and discontent at the injustice done to them and the hypocrisy of the rulers and elites of the caliphate grew.

Map of Iraq and al-Ahwaz at the time of the Zanj revolt – image by Ro4444 / Wikimedia Commons

The great Zanj revolt that broke out in 869 was preceded by two smaller uprisings in the region. There was an insurrection in 689-690. This was not an organized rebellion and involved gangs of angry slaves who pillaged and ransacked whatever they could get their hands on. They were easily defeated by an army sent from Basra. Those Zanj not killed in the fighting were beheaded and their bodies were gibbetted as an example for others. The second revolt took place in 694 and seems to have been slightly more organized. It had a leader Shir Zanj (the lion of the Zanj), and it took two expeditions to crush it.

This second revolt was more dangerous because the Zanj seem to have been stirred up by propaganda and were organized to a certain degree, which enabled them to defeat the first punitive expedition sent against them. The oppressive apparatus of the rulers and slave masters seems to have intensified after this point, because for two centuries sources are silent regarding the Zanj’s political or military activities. It is not until the arrival of Ali ibn Muhammad, a mysterious figure who managed to unite the Zanj and the other downtrodden elements of the society of Southern Iraq and the marshes that the Zanj rose up again, this time they succeeded in establishing an independent polity populated primarily by former slaves and indentured laborers and formed a significant threat to the stability and economy of the caliphate.

The Leader

Ali ibn Muhammad is an obscure figure who appeared on the world stage suddenly. The historian al-Tabari states that Ali claimed that his ancestor was Muhammad ibn Hakim from Kufa. This ancestor had participated in Zayd ibn Ali’s Shiite uprising against the Umayyads in 740. When the revolt was defeated he fled to Rayy (near modern day Tehran in Iran) and took up residence there. Ali’s paternal grandfather moved back to Iraq and bought a concubine from Sind (part of modern day Pakistan), who bore him a son, Muhammad, who was Ali’s father. He became associated with some of the courtiers of the Abbasid caliph, al-Muntasir, and derived a living through them by praising them through poetic verses.


In 863 he moved to Bahrain, which in the ninth century comprised a large region of what is Eastern Arabia. There, Ali ibn Muhammad claimed a genealogy back to Ali ibn Abi Talib, the Prophet Muhammad’s cousin and one of the revered imams of the Shiite sect of Islam. He immediately attracted a large following among the tribes in the region, who regarded him as a prophet. Taxes were collected in his name and he ruled them as prophet, judge, and king. He claimed that one of the signs of his divine leadership was that verses of the Quran that he had never read before were revealed to him and that he could recite them from memory, despite never previously having seen or heard them. He and his followers fought against the forces of the Abbasid government and rival desert tribes. He lost one of these battles in which many of his followers were slain. With this defeat he lost his charisma and credibility in the eyes of the Arab tribes, most of whom abandoned him.

Ali ibn Muhammad, having failed in Bahrain and being tired of the desert, set out for Basra with a few of his most loyal associates. At the time there were some civil disturbances in Basra due to a conflict between two large tribal factions. Ali’s goal was to exploit the chaos and to win the support of one of these groups. However, no one responded to his call and his representatives were dispersed by the soldiers of the local governor. After some of his companions were imprisoned, Ali fled from Basra only to be captured and imprisoned in Wasit. However, he was able to talk himself out of prison, a testament to his charisma and oratory skill, and made his way to Baghdad. In Baghdad he gathered more supporters before heading south to Basra again. He did not enter the city for fear of being arrested and it was in the outlying agricultural regions of Basra that he observed the Zanj and their poor living conditions.

A 16th century scene of Persians fighting against Africans – Mughal, India, c. 1580-1585. British Library. Darabname Or. 4615, f. 29b.

Ali and his band of supporters set up camp in the marshes and started to liberate the slaves. They initially ambushed small groups of 20-50 slaves who were lightly guarded as they were heading to work, killed or captured the overseers and liberated the slaves. Soon Ali had a considerable following of freed Zanj. He had convinced them that he was the right person to lead them. He vowed to them that he would be fair and just to them, that he would treat them with dignity, and that he would never betray them. He also promised that he would grant them wealth and property, including slaves. It is important to note here, that slave revolts such as the Zanj Rebellion or the uprising led by Spartacus against the Romans did not intend to abolish the institution of slavery, but rather to lift the rebels out of their status as slaves. Furthermore, in an ironic reversal of roles, the Zanj were given whips to beat the overseers and slave masters who had been captured during Ali’s raids.

As the ranks of his army swelled, Ali ibn Muhammad launched raids against the towns and villages in the vicinity of the marshes. He cleverly selected green and red to be the colors of his banner. Green had always been the color of the Shiites reinforcing his claim that he was a descendent of the prophet’s cousin. Red, on the other hand, was the color of the Kharijite sect and reinforced the egalitarian nature of his movement that promised his supporters equality and dignity. Initially the rebels were very poorly equipped for war. Al-Tabari states that there were only three swords in the entire army at the beginning of the revolt. Most of the freed Zanj slaves used sticks, farming implements, and anything else that they could get their hands on to fight. There are examples in the sources of Zanj using trays and trumpets to strike at the soldiers sent against them.

The Battle of the Barges

Initially, the caliph and his inner circle did not take the Zanj revolt seriously. In fact, the matter was relegated to the local governor and the magnates in Basra. At this point the caliphate was dealing with threats on multiple fronts. In Egypt, the governor, Ahmad ibn Tulun, seceded and proclaimed his independence, an act that would wrest Egypt and parts of Syria from Abbasid control for several decades. At the same time, the Saffarids in Sistan and Khurasan were directly challenging Abbasid authority and expanding towards Western Iran and Iraq at an alarming rate. Due to these challenges, which were deemed more important than a group of upstart slaves, the Abbasids did not initially pay much attention to the Zanj.

Ali ibn Muhammad and his Zanj army, which was also joined by local peasants, scored a number of victories against the governor’s forces and the mercenaries hired to suppress them. They successfully used the geography of the marshlands to their advantage, luring their enemies into traps and ambushes. With each victory, the Zanj captured weapons, boats, much needed supplies, and valuables. The rebels were merciless towards the soldiers sent to suppress them and to once again cast them into the shackles of slavery and beheaded any prisoners who fell into their hands.

A good example of the Zanj’s tactics can be seen in the first major battle they fought against the Basrans. At the Battle of the Barges, two months into the rebellion in 869, the rebels, who had made a premature attack on Basra and had been forced back, laid an ambush for the pursuing Basran army composed of volunteers. The Basrans advanced along a canal and were met by a detachment of the Zanj army, which had been divided into three parts. The other two sections of the Zanj forces were hidden in the reeds along the banks of the canal and allowed the Basrans to pass and to only attack when they had engaged the Zanj forces facing them. The result was an overwhelming Zanj victory and the almost complete annihilation of the Basran army.

The Zanj victory at the Battle of the Barges got the Abbasids’ attention. They sent a detachment of Turkish troops to deal with the Zanj. However, these troops did not make much headway because despite being excellent soldiers and cavalrymen, the Turks found it difficult to negotiate the swampy terrain. After a daring night raid on their camp, these elite government troops were also driven out of the marshes and forced to make a tactical withdrawal to Basra.

Over the next two years the Zanj defeated another army sent against them and in 870 they successfully blockaded Basra. After a year of blockade the city fell to the Zanj who exacted a dreadful revenge against its inhabitants whom they blamed for the injustices and cruelties they had suffered. Wealthy men were tortured to reveal the location of their hidden wealth and to the horror of the people of the caliphate women and children were carried away to become slaves for the Zanj in their new capital in the marshes, al-Mukhtara. According the al-Mas‘udi, who lived a few decades after the revolt ended, 300,000 of Basra’s inhabitants were massacred after the city fell. However, this number seems rather high and most scholars agree that around 10,000-20,000 of Basra’s inhabitants were killed during the sack of Basra. The fall and pillaging of Basra was such a serious blow to the Abbasids that the caliph’s own brother, al-Muwaffaq, personally led an army to fight the Zanj. After some initial successes his forces were defeated in battle and he was forced to withdraw due to the disease, lack of supplies, and constant attacks launched by the rebels.

A mounted warrior in a Furūsiyya manuscript

For the next several years the rebels took the offensive. They defeated every army sent against them and suffered few reverses. By 879 the territory controlled by the rebels reached its furthest extent. It consisted of most of Southern Iraq and Ahwaz including the major cities of this region such as Rumhurmuz, Ubulla, and Wasit. Their successes were so great that by this year they had managed to advance to less than 50 miles from Baghdad.

The fall of the Zanj

The Abbasid government took the initiative once again at the end of 879. Al-Muwaffaq and his son, the future caliph al-Mu‘tadid, led a large and well equipped army against the Zanj. On all fronts they pushed the rebels back into the swamps so that by 881 they had contained them in and around their capital, al-Mukhtara. Al-Mukhtara would fall after a two years. The Zanj put up a stiff resistance making the Abbasid forces pay heavily for every step that they advanced into their capital as they fought both the enemy and the inhospitable environment of the swamps. Although victory seemed inevitable at this point, al-Muwaffaq realized that force alone would not bring the revolt to an end quickly enough. To end the fighting more quickly and to cut the costs of the campaign both in lives and resources he offered amnesty and a place in his army to any of the rebels willing to defect to his side. By giving the rebels this choice al-Muwaffaq also gained a valuable new contingent of soldiers who were very adept at fighting in the marshes and whose assistance was instrumental in striking the deathblow to Ali ibn Muhammad and those among the rebels who remained loyal to him.

By August 883, al-Mukhtara fell to the Abbasids. Ali ibn Muhammad fell in battle as he and his loyal supporters were surrounded and cut down. His head was raised on a pike and displayed for all to see, especially those Zanj who had continued resisting the Abbasids. After this point thousands of Zanj streamed into the Abbasid camp. Al-Muwaffaq granted them all amnesty due to their large number, their prowess, and also because he realized that if he punished them other elements of the Zanj army still at large in the marshes would continue to fight and be a menace to the caliphate.

Although the rebellion was finally crushed after almost 15 years of fighting, its consequences were to haunt the Abbasids until the fall of their caliphate in 1258. The fighting and pillaging that took place during this conflict greatly devastated the agricultural lands of Southern Iraq, which resulted in a major decrease in the revenues that went into the royal treasury. The revolt also disrupted the economic activities in the region and combined with the decrease in agriculture some regions were hit with serious food shortages and famines. This decline in revenues greatly weakened the caliphs and their sphere of influence continued to shrink until they only wielded direct political authority over Baghdad and its immediate environs. In fact, the resources and manpower that had to be diverted against the Zanj resulted in the loss of Abbasid control over significant parts of the caliphate.

The loss of life was also heavy with sources reporting the death toll anywhere between 500,000-2,500,000. As in most such cases, the sources tend to be biased and inaccurate when it comes to numbers. However, considering the length of the revolt and the almost constant state of fighting and raiding that took place during the years 869-883, it would not be an exaggeration to put the estimate of the death toll in the tens or even hundreds of thousands.

Another important consequence of the Zanj revolt was that never again would we see the implementation of mass agricultural plantation slavery on a large scale in the Muslim world after the failure with this experiment in Southern Iraq. Although the Zanj revolt was a very destructive and violent episode in the history of the Abbasid caliphate, it highlights the struggle of a group of people from the lowest, poorest, and most unjustly treated echelons of society against one of the most powerful empires of that age. Despite the odds being stacked against them these rebel slaves and their charismatic leader were able to establish and maintain a polity in the marshes while under constant attack for a decade and a half, which was no small feat.

Adam Ali is a lecturer at the University of Toronto. Click here to read more from Adam.

Further reading:

Popovic, Alexandre. The Revolt of the African Slaves in Iraq in the 3rd/9th Century (Markus Wiener, 1999)

Al-Ṭabarī. The History of al-Ṭabarī = Tārīkh al-Rusul wa al-Mulūk. 40 vols. (State University of New York Press, 1985-?. Vol 36.)

Talhami, Ghada Hashem. “The Zanj Rebellion Reconsidered.” The International Journal of African Historical Studies, Vol. 10, No. 3 (1977), pp.443-461.

Top Image: La Vengeance des fils d’Antar, by Nasreddine Dinet (1861–1929)