Around the tenth century, much of eastern Arabia was under the control of a sect called the Qarmatians. The Qarmatians had attracted support through their egalitarian principles; but they waged war against the Caliphate and alienated many Muslims through their actions.
After inflicting several defeats on the Caliph’s army and launching raids against Kufa and Basra, in 929 AD the Qarmatians attacked Mecca, causing widespread death and destruction. They stole the black stone of the Kaaba and took it back with them to Al-Hasa. The whole Muslim world was outraged and the pilgrimage to Mecca had to be suspended for eight years due to continuing Qarmatian attacks against the pilgrimage routes.
The Qarmatians later declared a Persian youth to be the Mahdi who had returned to the world to bring about a “post-Islamic” age.
However, once this Persian was put in command he started preaching Zoroastrianism. He executed many local officials, and tried to force the Arabians to worship fire and curse the Prophet Mohammed. Such incidents caused Bahrainis to be deeply opposed to the Qarmatian movement.
The people of Bahrain were the first to rise up against the Qarmatians in 1058. The below account is based on the version told by the Bahraini poet Ibn al-Muqarrib:
Abul-Bahlul al-Zajjaj from the Abdul-Qais tribe was a tax collector in Bahrain. He convinced the Qarmatians to allow the building of a Mosque, so that non-Qarmatian visitors could worship Allah.
The Qarmatians built no Mosques and rejected communal prayers; although they still claimed to be Muslims.
When the Mosque was finished Abul-Bahlul’s brother Abul-Walid mounted the pulpit and delivered a sermon preaching loyalty to the Abbasid Caliph.
Many Qarmatians declared this declaration of loyalty to the Caliph to be blasphemy. However, Abul-Bahlul smoothed things over with gifts to the Qarmatian leaders. Abul-Bahlul and Abul-Walid were allowed to continue preaching at the Mosque; building up support among the ordinary people of Bahrain.
When the Qarmatian leaders asked the local Commissioner, Ibn-Arham, to increase taxes. Ibn-Arham came to an understanding with Abul-Bahlul that Bahrainis should refuse to pay the tax.
Ibn Arham then told the Qarmatians that he couldn’t anger the Bahrainis by collecting more money. The Qarmatians sacked Ibn Arham and sent a new Commissioner; recruiting thugs to seize property and enforce payment.
The people of Bahrain were afraid and agreed to support whatever course of action Abul-Bahlul advised. They agreed to refuse the taxes and demand the reinstatement of Ibn-Arham.
30,000 Bahrainis rose up in support of Abul-Bahlul when the new Commissioner arrived in Bahrain to arrest Abul-Bahlul and the leading rebels. The Bahrainis forced the Commissioner to flee back to his ship and several of his thugs were killed.
The Qarmatian leadership then invaded Bahrain with 180 boats loaded with 500 horses. The bugles and drums of Abul-Bahlul’s supporters caused the horses to panic and most boats sunk.
The victorious Bahrainis captured 200 horses and many weapons. The leaders of the invading force sought the protection of Abul-Bahlul; but 40 leading Qarmatians were executed.
Soon afterwards, the people of Qatif and Al-Hasa in eastern Arabia also rose up against the Qarmatians. Abdullah Bin Ali Al Ayouni defeated the Qarmatians after besieging them at Al-Hoffuf Oasis for seven years; with support from the Abbasid Caliph and the Sunni Seljuk rulers.
Abdullah Al Ayouni became the ruler of the islands of Bahrain; as well as Al-Hasa and Qatif. He was the founder of the Ayouni dynasty, which ruled this greater region of Bahrain for nearly two centuries. The Ayouni leaders remained loyal to the Caliphate, and in return the Caliph delegated to the Ayouni rulers the task of protecting the pilgrimage to Mecca.