They were destroyed after Khalid's departure by the Bavandid Sharvin. In 164/781, at a time of unrest in Khurasan, the caliph al-Mahdi sent messengers to the ruling princes of the east, among them "the king of Tabaristan the Ispahbad" (Vindadhhurmuzd) and "the king of Tukharistan Sharvin", and received pledges of their loyalty. Yet two years later Vindadhhurmuzd in alliance with Sharvin and the Masmughan of Miyandurud led a dangerous anti-Muslim rebellion. The local chronicles report, no doubt exaggerating, that all Muslims throughout Tabaristan were massacred on a single day. The massacres presumably were confined to the highlands and those parts of the lowlands which the rebels were able to overcome.
They defeated the first Muslim armies sent against them and killed some of their leaders. The rising was serious enough for the caliph to send in 167/783-4 his son Musa with "a huge army and equipment such as no one previously had been equipped, to Gurgan to direct the war against Vindadhhurmuz and Sharvin, the two lords of Tabaristan". In the following year al-Mahdi sent another army of 40,000 men under Sa'Id al-Harashi to the rebel province. Eventually Vindadhhurmuzd was defeated and wounded and gave himself up to Musa in Gurgan on a promise of pardon. Musa after his succession to the caliphate in 169/785 took him to Baghdad, but soon permitted him to return to his domains.
Relations with the Muslim governors then remained amiable for some time. Jarir b. Yazid, governor from 170/786 to 172/788, sold Vindadhhurmuzd extensive holdings of domanial land outside Sari. In the later years of the reign of Harun al-Rashid, however, new troubles occurred. The two kings of the mountains in alliance strictly controlled the access to their territories and would not permit any Muslim to be buried there. The men of the Bavandid Sharvin murdered a nephew of the governor Khalifa b. Sa'Id whom the latter had appointed his deputy. In 189/805 Vindaspagan, the brother of Vindadhhurmuzd, killed a Muslim tax collector sent to survey his villages. The caliph, who came to Ray in order to settle matters with a governor of Khurasan of doubtful loyalty, sent to the two princes of Tabaristan bidding them to appear before him.
Both kings hastened to assure Harun of their submission promising payment of the land tax, and Vindadhhurmuzd presented himself to the caliph who confirmed him as Ispahbad. On his request Harun replaced the governor of Tabaristan, but gave the new governor instructions to restrict the authority of the princes to the highlands. As hostages for their loyalty he took Qarin, the son of Vindadhhurmuzd, and Shahriyar, the son of Sharvin, to Baghdad. They were returned to their fathers four years later when Harun passed through Ray on his way to Khurasan.