Kakuyids

The Kakuyids (also called Kakwayhids, Kakuwayhids or Kakuyah) () were a Shia Muslim dynasty of Daylamite origin that held power in western Persia, Jibal and Kurdistan (c. 1008–c. 1051). They later became "atabegs" (governors) of Yazd, Isfahan and Abarkuh from c. 1051 to 1141. They were related to the Buyids.
Origins.
Scholars state that the Kakuyids were Daylamites, and relatives of Sayyida Shirin, who was from the Daylamite Bavand dynasty.
History.
The Kakuyids were given control of Isfahan in or before 1008 by Sayyida Shirin, who held the regencies of her young Buyid sons Majd al-Dawla of Ray and Shams al-Dawla of Hamadan. The man who was given the administration of the city was Muhammad ibn Rustam Dushmanziyar. Over time, he effectively became independent of Buyid control.
At times Muhammad ibn Rustam Dushmanziyar acted as an ally of the Buyids; when Shams al-Dawla was faced with a revolt in Hamadan, for example, he turned to the Kakuyids for aid. Shortly after Shams al-Daula died, he was succeeded by Sama' al-Dawla, however, the Kakuyids invaded and took control of Hamadan in 1023 or 1024. They then moved on and seized Hulwan from the 'Annazids. The Buyid Musharrif al-Dawla, who ruled over Fars and Iraq, forced the Kakuyids to withdraw from Hulwan, but they retained Hamadan. Peace was made between the two sides, and a matrimonial alliance was eventually arranged.
Muhammad ibn Rustam Dushmanziyar was succeeded in 1041 by his son Faramurz. While in Hamadan another Kakuyid, Garshasp I, took power. In 1095, Garshasp II became the new Emir of the Kakuyid dynasty, and was later killed at the Battle of Qatwan. Faramurz's reign was cut short by the Seljuks, who after a year-long siege of Isfahan took the city in 1051 or 1052. Despite this, Faramurz was given Yazd and Abarkuh in fief by the Seljuks. The Kakuyids remained the governors of these provinces until sometime in the mid-12th century; their rule during this time was known for the construction of mosques, canals and fortifications.