The weakening of the caliphate towards the end of the 10th century was complemented by the rise of indigenous dynasties within Iran. These were based on family grouping. Western Iran was larely controlled by the Deylamids, who in turn were divided into Buyids and Kakuyids.
From the architectural point of view the most important is Fakhr-al-Daula, whose minister Saheb Ibn-e-Abbad erected this gateway to a mosque which was later replaced by the Masjed-e-Hakim.
The Kakuyid ruler Ala' al-Daula Muhammad (1008-1041/2) patronised Avicenna and encouraged him to establish his school in Isfahan. He extended the fortifications of Isfahan and erected twelve metal covered gates as a defence against the marauding Turkomen tribesmen. Shortly before his death he declared allegiance to the Seljuks who by now occupied most of central Iran. His son Faramurz eventually yielded up Isfahan to the Seljuk leader, Toghril Beg, after a long seige during which the inhabitants used wood from the Masjed-e-Jomeh to keep themselves warm.