Al-Hasan, who adopted the regnal name al-Da'i ilcfl-haqq^ became the founder of the Caspian Zaidi reign. In the following year he was forced by a counter-offensive of the Tahirid Sulaiman b. 'Abd-Allah to seek refuge in the country of Dailaman, but before the end of the year he was safely in possession of all of Tabaristan. From 253/867 on he usually also held sway over Gurgan. Other 'Alids with his support temporarily gained control over Ray (250-1/864-5, 253/867, 256/870, 258/872), Zanjan, Qazvin (251-4/865-8) and Qumis (259-66/873-9). On two occasions al-Hasan was again compelled to flee to Dailaman. In 255/869 the 'Abbasid general Muflih and in 260/874 Ya'qiib al-Saffar invaded Tabaristan and Ruyan, but both withdrew in short order.
When al-Hasan died in Amul in 270/884, his brother Muhammad, whom he had named his successor, was in Gurgan. In Tabaristan al-Hasan's brother-in-law, the 'Alid Abu'l-Husain Ahmad b. Muhammad, usurped the rule for ten months until he was overthrown by Muhammad. The latter, who assumed the same regnal name as his brother, gained popularity with the Shi'is everywhere by restoring the shrines of 'All and al-Husain destroyed by the caliph al-Mutawakkil and by sending liberal gifts to the cAlids outside his domains. In 277-9/891-3 Rafi' b. Harthama, then in control of Khurasan, conquered Tabaristan and penetrated deep into the regions of Dailaman and Gllan where the 'Alid had sought shelter. When the caliph al-Mu'tadid in 279/892 granted the governorship of Khurasan to his rival, the Saffarid 'Amr, Rafi' made peace with Muhammad b. Zaid restoring Tabaristan to him and pledging allegiance to him. In 283/896 he occupied Nlshapur for a short time and introduced the 'Alid's name in the khutba there, but cAmr soon expelled him. In 287/900 Muhammad set out to conquer Khurasan. He was defeated and killed by the Samanid army under Muhammad b. Harun al-Sarakhs! at Gurgan. His son and heir-apparent Zaid was carried off to Bukhara, and al-Sarakhsl took possession of Tabaristan.
The reign of the two 'Alids was supported most steadfastly in Ruyan and Kalar. In Tabaristan and Gurgan initial enthusiasm for the new regime soon gave way either to fickle support or to latent opposition. The reliance of the regime on rough and undisciplined Dailamite soldiers gave cause to complaints in the towns. The official espousal of Shf i doctrine and Mu'tazili theology provoked resistance among the Sunni Ulama which the rulers did not hesitate to counter with stern measures of repression. The Qarinid Baduspan loyally supported al-Hasan b. Zaid, but his son Shahriyar later opposed Muhammad. The Bavandid Qarin and his grandson and successor Rustam were traditionally hostile and missed no chance of fomenting trouble and allying themselves with the foreign enemies of the regime. Rustam eventually in 282/895 was imprisoned and tortured to death by Rafi' b. Harthama, who at that time supported Muhammad b. Zaid, and the Bavandid reign lapsed temporarily.