Mardavij was born ca. in 890 in Gilan; he was the son of Ziyar, who belonged to the Shahanshahvand, a royal clan that roamed in Dakhel. Mardavij's mother was a sister of Harusindan, a Gilaki ruler. Mardavij belonged to the Arghich tribe, which claimed to be descended from Arghush Farhadan, king of Gilan who lived during the time of Kay Khosrow. Mardavij grew up in an environment where memories of the glories of the Iranian Empire were alive in the Iranian culture. According to the 10th-century Arab historianal-Masudi, most of the Daylamite and Gilaki leaders, who were Zoroastrian and pagan, had become atheists. Mardavij was one of the many Gilaki leaders that entered into the service of the Alids, after establishing their rule over Tabaristan, Gilan, and Daylam.
Rise to power
Around 913, Mardavij joined the army of Asfar ibn Shiruya, a military leader from Lahijan, who served the Zaydids of Tabaristan. In 930, Asfar invaded the domains of the Zaydi Abu Muhammad Hasan ibn Qasim. During the invasion, Mardavij managed to heavily wound Abu Muhammad near Amol, thus avenging his maternal uncle Harusindan, who was killed by the hands of the Alids. The army of Asfar then marched towards Ray, where they defeated the Daylamite general Makan ibn Kaki, who fled to Daylam. Asfar managed to successfully conquer Tabaristan, and also captured Qazvin and Zanjan. He then appointed Mardavij as the governor of Zanjan. In 930, Mardavij along with Asfar's brother, Shirzad, were ordered to capture Tarom, the capital of the Sallarid ruler Muhammad bin Musafir. During the siege, Mardavij, on the urging of Makan and Muhammad, betrayed Asfar by revolting against him. With the aid of Muhammad and Makan, Mardavij defeated and killed Shirzad, including other members of his tribe. He then marched towards Qazvin, the residence of Asfar. However, Asfar managed to flee. Mardavij thus founded the Ziyarid dynasty, and became ruler of Asfar's former territories, which included; Ray, Qazvin, Zanjan, Abhar, Qom and Karaj. He is said to have worn a "crown of Anushirvan" at his court.
Reign
In the same year, Makan managed to defeat Mardavij, and briefly recover Tabaristan. Makan then extended his rule over most of Gurgan and even take possession of Nishapur in western Khurasan, which he was forced to abandon in 931, bowing to pressure by the Samanid ruler Nasr II. In 931, Mardavij sent an army against Makan, but the latter defeated Mardavij's forces in a first engagement in 931. Eventually, after Makan's return to Tabaristan from Nishapur, Mardavij personally launched an attack that conquered Tabaristan. Mardavij then aggressively began expanding his domains, by attacking Asfar, who was now residing in Hamadan after his disastrous defeat. In 931, Mardavij managed to defeat and kill Asfar. He then began quickly capturing the Abbasid cities of Hamadan, Dinavar, and Kashan, and finally in Isfahan, which became his capital. He then appointed his brother Vushmgir as the governor of Amol. Mardavij planned to conquer Baghdad, remove the caliphate, be crowned in Ctesiphon and restore the Iranian empire. Just after Mardavij's victory, Ali ibn Buya, along with his two brothers Hasan ibn Buya and Ahmad ibn Buya, managed defect to Mardavij's side just as he was preparing to undertake the conquest to the south of the Alborz mountains as far as Qazvin. Not long afterwards Mardavij granted Ali administrative rule over Karaj, a strategically important town probably situated near modern Bahramabad. While making a stop in Ray on his way to Karaj, however, Ali was warned by Mardavij's vizier al-'Amid that Mardavij was planning to eliminate him. Hurriedly leaving Ray, he arrived at and took over Karaj. In 933, Mardavij made peace treaty with the Samanid ruler Nasr II; Mardavij agreed to cede Gurgan to the Samanids and pay tribute for his possession of Ray. Mardavij then began to focus on western Iran, where his troops managed to conquer as far as Ahvaz, and forced Ali, who was now in Shiraz, to once again acknowledge his authority. Mardavij then had a golden throne with jewels, a tunic, and a golden crown made. His crown was reportedly the same shape of the crown of the Sasanian king Khosrow I. He also had a few silver thrones made for his best generals. Rumours had spread that Mardavij was planning to march to Baghdad and destroy the Abbasid Caliphate, and that he had made an alliance with the Qarmatians of Bahrain.
Death
In January 935, shortly before Nowruz festivities, Mardavij was assassinated by his Turkish slaves, whom he had treated badly, while favoring his Daylamite/Gilaki troops. After his assassination, many of his troops entered the service of the Abbasids, while some others joined Ali, who founded the Buyid dynasty, and had taken over Mardavij possessions in central and southern Iran. Mardavij's brother Vushmgir succeeded him in northern Iran. Mardavij was buried in Gonbad-e Mardaviz, a place located in the north east of Amin Abbad Borough in the city ofRey, south of Tehran.
Legacy
Mardavij was one of the most notable figures in northern Iran known for preserving and advocating pre-Islamic Iranian customs. During the Pahlavi era, where interest in pre-Islamic Iran was high, Mardavij appeared as the hero in stories and comic strips of children's magazines in the 1960s.