Qabus ibn Wushmagir (full name: Abol-Hasan Qābūs ibn Wušmagīr ibn Ziyar Sams al-maʿālī, ; (died 1012) (r. 977–981; 997–1012) was the Ziyarid ruler of Gurgan and Tabaristan in medieval Iran. His father was Vushmgir and his mother was a daughter of the Bavandi Ispahbad Sharwin II. Struggle for power Upon Vushmgir's death in 967, his eldest son Bisutun marched to the capital Gurgan to take control of the Ziyarid state. A Samanid army that had arrived shortly before Vushmgir's death for a joint campaign against the Buyids, however, threw its support behind Qabus. When Bisutun gained the assistance of the Buyid Rukn al-Dawla the Samanid army left for Khurasan. Qabus found a new ally in al-Hasan ibn al-Fairuzan, who ruled in Semnan, but Bisutun occupied both Gurgan and Semnan, forcing Qabus to give up his claims as his father's successor. Reign Bisutun's death in 977 provided Qabus with another opportunity to take control of the Ziyarids. Bisutun's governor of Tabaristan, the Gilite Dubaj ibn Bani, supported the deceased ruler's young son, and could rely on Samanid support. Qabus gained the loyalty of the Ziyarid army, however, and received assistance from the Buyid 'Adud al-Dawla. Taking Gurgan from Dubaj, he captured Bisutun's son in Semnan. In 978 or 979 the caliph al-Ta'i granted Qabus the title Shams al-Ma'ali. In 980 Qabus offered refuge to the Buyid ruler of Ray, Fakhr al-Dawla, who had recently fought a losing war with 'Adud al-Dawla. The latter offered the Ziyarid money and territory in exchange for the surrender of Fakhr al-Dawla, but Qabus refused. 'Adud then invaded and conquered Tabaristan; in 981 'Adud's brother Mu'ayyad al-Dawla took Gurgan. Qabus and Fakhr al-Dawla were forced to flee to Samanid Khurasan. The Samanids sent a force to take back the provinces, but were unsuccessful. In 984 Fakhr al-Dawla was able to recover his territories in Ray. Upon the advice of his vizier, however, he refused to return control of Gurgan and Tabaristan to Qabus. Qabus was forced to live in exile until 997, when Fakhr al-Dawla died and was succeeded by his young son Majd al-Dawla. Supporters of the Ziyarid gained control of Tabaristan and from there conquered Gurgan. Qabus returned there in 998. A few later Buyid attempts to expel him again failed. Although he formally recognized the caliph as his sovereign, Qabus ruled effectively as an independent ruler for the rest of his reign. He