Al-Mansur Muhammad attacked Tahiride positions between Dhamar and San'a in 1496 and 1498. On the latter occasion the imam's forces were completely routed. After the death of al-Mu'ayyad Muhammad bin an-Nasir in 1503, San'a was dominated by a certain Sharib. In the next year, the Tahiride Sultan Amir attacked the city. Al-Mansur Muhammad hastened down to relieve the defenders of San'a, but he fell in the hands of Sultan Amir. The Tahirides entered San'a and a reign of terror ensued. The captured imam was poisoned in prison in San'a three months later. The Tahiride triumph was just temporary. Two years later the Zaidi imamate was continued in the person of al-Mutawakkil Yahya Sharaf ad-Din, who managed to unite large parts of Yemen under his authority.