Muhammad ibn Rustam Dushmanziyar

Muhammad ibn Rustam Dushmanziyar (Persian: ابوجعفر دشمنزیار), also known by his laqab of Ala al-Dawla Muhammad (علاء الدوله محمد), was a Dailamite military commander who founded in 1008 the short-lived but important independent Kakuyid dynasty in Jibal. He is also known as Pusar-i Kaku, Ibn Kakuyeh, Ibn Kakuya, and Ibn Kaku, which means maternal uncle in the Deylami language, and is related to the Persian word "kaka". Muhammad died in September 1041 after having carving out a powerful kingdom which included western Persia and Jibal. However, these gains were quickly lost under his successors.

Origins
Rustam Dushmanziyar, the father of Muhammad, was a Dailamite soldier in the service of Buyids and was rewarded with land in Alborz in appreciation of his services. His duty was to protect Ray and northern Jibal against the local leaders from Tabaristan. Rustam was the brother of the Bavandid princess Sayyida Shirin, the mother of Buyid emir Majd al-Dawla and Shams al-Dawla. Both were under the tutelage of their mother Khatun until her death in 1029.

Reign
Given these family ties, it is not surprising that from 1007 to 1008 Muhammad was the governor of Isfahan on behalf of the Buyids. Some sources say he was already in governor of the city in 1003. In 1016, the Dailamite military officer Ibn Fuladh expelled Muhammad from Isfahan, but he shortly managed to regain control of the city. The fragility of Majd al-Dawla's kingdom later encouraged Muhammad to extend his domains in the Kurdish held mountains of Iran. In 1023, Muhammad seized Hamadan from the Buyid ruler Sama' al-Dawla, and then proceeded to capture Dinavar and Shapur-Khwast from Kurdish leaders. He spent the following years in protecting his realm from invasions by the Kurds and princes (ispahbadh) from Tabaristan.

Five years later, Muhammad won a great victory over his rivals at Nihawand, and managed to capture the Bavandid ruler Abu Ja'far Muhammad including his two sons. After this great victory, Muhammad consolidated his position as the strongest ruler of Jibal, even though the Buyid emir Majd al-Dawla was his overlord, Muhammad minted coins in his own name. He was later personally awarded, and without the intervention of the Buyids, from the Abbasid caliph Al-Qadir, the title of "Husam Amir al-mu'manin" (Sword of the commander of the faithful).

In 1029, Majd al-Dawla was deposed by the Ghaznavid Mahmud. Mas'ud I, the son of the Ghaznavid sultan, who wanted to liberate the Abbasids from Buyid control, proceeded further into western Iran, where he defeated various rulers, including Muhammad, who fled to Ahvaz to seek help from the Buyids, but he quickly made peace with the Ghaznavids and returned as their vassal, where he accepted to pay an annual tribute of 200,000 dinars. The Ghaznavids, however, were not able to hold their conquests which were distant from Ghazni, without trouble. Muhammad managed to briefly occupy Ray from the Ghaznavids in 1030. In 1035, Mas'ud I again defeated Muhammad who fled to once again fled to the Buyids in Ahvaz, where he later fled to northwestern Iran. Muhammad then began recruiting a powerful force of Turkmens in order to re-gain his lost domains.

In 1037/38, Muhammad, along with his forces, once again occupied Ray from Ghaznavids. In the following years, Muhammad began constructing massive defensive walls around Isfahan. Which later saved it from the Turkmen nomads who sacked and plundered some places in west and central Iran in 1038/39, including the city of Hamadan.

Death
Muhammad died in September 1041 when he was campaigning in western Persia against the Annazids. His eldest son Faramurz succeeded him in Isfahan while his younger son Garshasp I gained Hamadan. However, they had a difficult task in protecting these regions from the expansionist Seljuqs.

Legacy
Muhammad was a great military commander who managed to protect his kingdom from its neighbors, including the Buyids, Ghaznavids and Seljuqs. He was anything but an ignorant savage as were some of the earlier Dailamite military leaders. He invited the philosopher Avicenna to his court after Avicenna left the court of the Buyids, where he made an encyclopedia dedicated to the emir. The great philosopher and scientist died in 1037. The library of Avicenna was later plundered by the Ghaznavids who carried it off to Ghazni where it was later destroyed by the Ghurids under their ruler Ala al-Din Husayn.