Meanwhile, Hasan al-A'sam, the son of Ahmad Abu Tahir and a nephew of Abu Tahir, had become the commander of the Qarmatian forces, who was usually selecting to lead the Qarmatians in their military campaigns outside Bahrain. In 357/968, Hasan al-A'sam had taken Damascus after defeating Hasan bin Ubaidullah bin Tughj, the Ikhshidid governor of Syria. The Qarmatians also sacked Ramla and took vast riches and returnced to Bahrain. About three months following the Fatimid conquest of Egypt, a Qarmatian force, commanded by al-A'sam's cousin, again came to Damascus and defeated Hasan bin Ubaidullah, the Ikhshidid governor of Syria. Finally, a peace treaty had been concluded between them, and according to which, the Ikhshidid agreed to pay an annual tribute to the Qarmatians. In 359/970, a large Fatimid force commanded by Jafar bin Falah was sent to conquer Syria. The Ikhshidid governor, Hasan bin Ubaidullah sought necessary help from the Qarmatians. Jafar bin Falah attacked at full gallop and defeated the joint forces of the Ikhshidid and the Qarmatians near Ramla. Hasan bin Ubaidullah was taken prisoner. The Fatimid conquered Syria, resulting the loss of the tribute to the Qarmatians being paid to them previously by the Ikhshidids. This is cited as the main cause for the invasion of the Qarmatians on Syria next year.
In 360/970, being helped by the Buwahid Izz ad-Dawla Bakhtiyar (356-367/967-978) and the Hamdanid Abu Taghlib of Mosul, the Qarmatian commander, Hasan al-A'sam captured Damascus and Ramla, having defeated the Fatimids and killed Jafar bin Falah in battle. Hasan al- A'sam, who had also allied himself with the Abbasids, proclaimed the suzerainty of the Abbasids in Syria and had Imam al-Muizz cursed in the mosques of Damascus.
In 361/971, Hasan al-A'sam marched towards Egypt and reached near the gates of Cairo, but he was turned back by the Fatimids, and was obliged to retreat to al-Ahsa, but Damascus remained in the hands of the Qarmatians. In 363/974, after coming to Cairo, Imam al-Muizz wrote a letter to Hasan al-A'sam, stating the dignity of Ahl-al-Bait and his own excellence. He also recalled the early relations of the Qarmatians with the Ismailis, and also warned him to refrain from his attacks. Hasan al-A'sam took no heed of al-Muizz's reproach, and made his letter public and denounced the Fatimids. He entered Egypt in 363/974 for the second time, and went as far as Ayn Shams and besieged Cairo, and took possession of the moat. The defeat of the Fatimid force on that occasion would have been inevitable had al-Muizz not won over to his side one of the allies of the Qarmatians, named Hasan bin Jarrah, who abandoned in the thick of the fight. Hasan al-A'sam was defeated and retreated, and died at Ramla in 366/977. His cousin Jafar took charge of the Qarmatians. In 368/978, Imam al-Aziz himself took field and subdued Iftagin and the Qarmatians near Ramla. The Qarmatians agreed to a peace. Henceforward, the Qarmatians of Bahrain were reduced to a local power. Most of the Qarmatians reverted to their original Ismaili faith, and left Bahrain and settled as isolated families in Oman, Muscat, Gwadar and Makran. The rest of the power of the Qarmatians declined when the Buwahids inflicted two heavy defeats in 375/985. In 378/988, the Qarmatians suffered another humiliating defeat at the hands of al-Asfar, the chief of the clan of Muntafiq, and after that, the Qarmatians almost disappeared from history. Silvestre de Sacy writes in his "Memoir on the dynasty of the Assassins" (Paris, 1818, p. 5) that he had learnt from books of the Druze that the Qarmatians were still ruling in al-Ahsa in 422/1031. We also learn from the "Safar-nama" (pp. 87-89) of Nasir Khusaro (d. 481/1088), who was at al-Ahsa in 443/1051 that the Qarmatians were ruling under a council of six descendants of Abu Sa'id, assisted by six vizirs, in the line of Ibn Sanbar. He also writes that the Friday prayers and other rites such as fasting were not observed at al-Ahsa, where all mosques had been closed. Around 450/1058, a certain Abul Bahlul al- Awwam of the tribe of Abdul Qays, aided by his brother Abul Walid Muslim, rebelled against the Qarmatian governor of Uwal. In the following year, the rebels defeated a Qarmatian fleet, and Qatif was snatched from them very soon. The Qarmatians were then threatened by Abdullah bin Ali al-Uyuni, the chief of the clan of Mura bin Amir of Abdul Qays, who rose against them in 462/1070 and defeated the Qarmatians and laid siege over al-Ahsa for seven years. Assisted by a force of Turkoman horsemen sent from the Abbasids, Abdullah bin Ali al-Uyuni seized al-Ahsa in 469/1076. He decisively subdued the Qarmatians in 470/1077, putting a definite end to the Qarmatian state of Bahrain, and founded a local rule of the Uyunids in eastern Arabia.