Overthrow of the Qarmatians

The Overthrow of the Qarmatians was an armed uprising by the Seljuk and Abbasid supported Uyunids against the ruling Qarmatian state. A local chief known as Abdullah bin Ali Al Uyuni aligned himself with the Abbasids and the Seljuk Empire, and started an uprising with their support. Due to support from more powerful foreign powers, the Uyunids successfully revolted and liberated Eastern Arabia, which significantly shifted the power dynamic in the region.

Background
The Qarmatians were a radical Isma'ili group with major Zoroastrian influences that had established its power in the eastern Arabian Peninsula. The Qarmatians became known for their raiding of caravans going to pilgrimage to Mecca. The Uyunids were a local Arab dynasty coming from the tribe of Bani Abd al-Qays. The chief of the dynasty Abdullah bin Ali sought help from Seljuks and Abbasids to combat Qarmatian rule in Eastern Arabia.

Abu al-Bahlul al-Awwam's revolt
Abu al-Bahlul al-Awwam was a guarantor of the Qarmatian state. Abu al-Bahlul later revolted in Bahrain, then crowned himself Emir of the island. Despite that he was unable to beat the new leader of Qatif, Yahya bin Abbas, and the island soon came under their control once more, killing Abu al-Bahlul in the process.

Uyunid revolt
The Uyunids under Abdullah bin Ali revolted against Qarmatian rule with Seljuk support. He quickly conquered Awal and Qatif, and exiled its new ruler, Yahya bin Al-Ayash and then invaded the Qarmatian stronghold of Hofuf. Seljuk and Uyunid forces marched down to Hofuf to take over the last part of land that was controlled by the Qarmatian state. They besieged the city for seven whole years, until it fell, the Qarmatian state fell with it, and the Uyunid Emirate was established, under the rule of Abdullah bin Ali.

Revolt of Zakariya bin Yahya
The situation wasn't stable afterwards due to internal conflicts between the Ayash family. There was enmity between the ruler of Awal, Hassan bin Yahya and his brother Zakariya bin Yahya. Zakariya wished to annex Awal and go to war with the Uyunid Emirate while his brother Hassan wished to strengthen the relations between the families and was a vassal of Al Uyuni. Zakariya killed his brother due to influences from his minister. He began to march to Al-Ahsa and raided villages on his way.

Al Uyuni received the news of Zakariyas army and raised a large army to confront Zakariya in the village of Nadhirah. Where Zakariyah lost a large portion of his army and was forced to retreat to Qatif, where he was kicked out to Awal. Al Uyuni's son Al-Fadl prepared a large fleet to destroy the remnants of Zakariyah's army. When Zakariyah heard of this he fled to Uqair, where he was met with combat by Al-Uyuni's army where he was killed and his army surrendered.

Conflict with the Seljuks
After Al-Uyuni unified the country, he was faced with external conflicts with the Seljuks due to Al-Uyuni killing a Seljuk general in an instance of friendly fire. The Seljuk Sultan Malik-Shah I ordered the governor of Kerman to raise an army and confront the Uyunids in Al-Ahsa. Seeing a huge difference of numbers between their armies, Al-Uyuni submitted and pledged loyalty to the Seljuks in response and offered to help the Seljuks invade Oman, to minimize Seljuk influence in his emirate.

Decline of Qaramatians in Multan
By the mid-10th century, persecution forced the Qarmatians to leave what is now Egypt and Iraq and move to the city of Multan, now in Pakistan. However, prejudice against the Qarmatians did not dwindle, as Mahmud of Ghazni led an expedition against Multan's Qarmatian ruler Abdul Fateh Daud in 1005. The city was surrendered, and Fateh Daud was permitted to retain control over the city with the condition that he adhere to Sunnism.

Aftermath
The Uyunids stabilized and rebuilt their state and expanded it. It is theorized that the populations of Qatif, and Al-Hasa accepted Twelver Shi'ism during their reign. The Uyunids reached their golden age under the rule of Abdullah bin Ali's son, Al-Fadl bin Abdullah. The Uyunids fell a while later to the Usfurids due to the poor rule of Mohammed bin Mas'ud. The Usfurids later fell to the Jarwanids of Qatif who later fell to the Jabrids.