Al-Hasan b. Zaid was checked in Tabaristan, but withdrew westwards into Dailam, where he energetically spread the Shi'i form of Islam in regions hitherto pagan, and achieved the reputation of a wise and just ruler. In 251/865 there was a further 'Alid rising against the Tahirid officials in Qazvin and Zanjan led by al-Husain b. Ahmad alKaukabi, aided by the Justanid ruler of Dailam. Two years later, al-Kaukabi was driven back into Dailam by Musa b. Bugha, but al-Hasan b. Zaid maintained his position in the Caspian region, and in 259/873 crossed the Alburz Mountains and occupied the province of Qumis. He continued to rule in Tabaristan till his death in 270/884, and his equitable rule there was praised by impartial historians. The history of Muhammad b. Tahir's governorship in Khurasan now merges into that of the first Saffarid, Ya'qub b. al-Laith, who gradually extended his power from Slstan, expelling the Tahirid governors from the towns of eastern Khurasan, and finally in 259/873 occupying Nishapur and deposing Muhammad b. Tahir; these events will be treated in more detail below. Muhammad b. Tahir's failure marks the end of fifty years' Tahirid control over Khurasan, although his brother al-Husain held out in Marv for some time longer, and various military commanders hostile to the Saffarids campaigned under the banners of legitimacy and restoration of the Tahirids. Muhammad b. Tahir was later re-appointed by the caliph al-Mu'tamid to Khurasan, but never dared to show himself there. He became governor of Baghdad in 270/883-4, and did not die until 297/910 or possibly the next year. His uncle 'Ubaid-Allah b. 'Abd-Allah b. Tahir held the governorship and shurta of Baghdad on various occasions under al-Mutazz and al-Mutamid, including after the death of Muhammad b. Tahir. During the reign of al-Mu'tadid he fell into a certain amount of hardship, in which he was helped financially by the caliph, and died in 300/913. 'Ubaid-Allah seems to have been on bad terms with his brother Sulaiman and nephew Muhammad, and this hostility presumably explains why 'Ubaid-Allah acted as representative in Iraq for the Saffarids Ya'qub and 'Amr b. al-Laith during those periods when they were able to exert influence there. The Tahirid family by no means disappeared in the 4th/ioth century, even though it no longer exercised any political power. Tha'alibi mentions one Abu'l-Tayyib al-Tahirl, who in the second half of the century lived on revenues from former Tahirid estates granted to him by the Samanids, but never ceased to hate the Samanids as supplanters of his own family.