Shiites had mixed fortunes under the Abbasid caliphs, sometimes enjoying relative freedom, at other times (most notably under Mutawakkil, who reigned from 847-861) facing oppression. The Shiite century, during which the Buyids, a Shiite Iranian dynasty, governed Iran and Iraq (945-1055) while the Ismaili Fatimids ruled over North Africa, Egypt, and parts of Syria (909-1171) witnessed the development of Shiite learning in various areas. A Shiite culture of public religiosity flourished as well, supported by the patronage of Shiite rulers who invested in shrines and scholarly institutions.Shiites lost political power again with the arrival of Turkish and Kurdish dynasties (such as the Seljuks and the Ayyubids) who were spearheads of the Sunni revival. The primary targets of this backlash were the Ismailis with their elaborate ideology and their aggressive political strategy. Thus, Saladin, who famously conquered Jerusalem in 1187, had also ended Fatimid rule over Egypt in 1171. Quietist Shiites continued being involved in high positions in the administration and even acted as patrons.
It was in the areas of modern-day Iran and Iraq under Buyid rule, in 963, that public processions to commemorate the martyrs of Karbala and Muhammad's (alleged) appointment of Ali at Ghadir Khumm took place for the first time officially. In addition to sponsoring shrines, the Buyids also paid pensions to the descendants of Ali and Fatima. The Alid family tree was closely supervised, which made false pretensions—either to claim material benefits from pious endowments or to assume political authority—difficult. At the same time, the Buyids could not rely on the Shiites as their sole support. They also adopted Iranian traditions of kingship and presented themselves as guardians of the Abbasid caliphs. The Buyid king of kings Adud al-Dawla even tried to merge the two lines when the Abbasid caliph Taii married his daughter. The Sunni population of Baghdad did not unanimously accept the public presence of the Shiites. Sunni rituals emerged to counter those of the Shiites, and the frequent riots between certain Sunni groups and Shiites in Baghdad made it prudent for the Buyids to limit their patronage.
The Fatimids were the second Shiite dynasty of the 10th and 11th centuries. As new and foreign rulers they faced similar problems as the Buyids but their strengths and weaknesses lay elsewhere. While the Buyids' Shiite affiliation led to a certain support among their subjects, the Fatimids, as Ismailis, belonged to a minority branch of Shiism and could not count on any Shiite communities (whether Imami, Ismaili, or other) in the areas between North Africa and Egypt where they established their rule. But whereas the Buyids had poor genealogical and cultural credentials and relied for their charismatic authority on military prowess, the Fatimids more or less successfully claimed descent from Muhammad. Perhaps because the virtual absence of Shiism from the Muslim West (mostly Muslim Spain, but apart from the Fatimid period also North Africa) left a gap in this area, Mahdism and Sharifianism (authority based on descent from the Prophet) were strategies often effectively employed by politico-religious movements to increase their authority.
The Fatimids first established their rule in modern-day Tunisia in 909-910, when their Mahdi revealed himself as such and claimed the title of Caliph. Baghdad remained the aim of the movement, and it was only logical that Egypt was the next step. It is here where the Fatimid Empire took shape. Cairo was founded in 970 as the new center for the mission, with the Azhar mosque as an important institution. In the modern period it is known as the university of Sunni learning with the highest standing in the Islamic world. The Ismaili mission continued, albeit not on a popular level, and would eventually lead to both Sunni and Ismaili counter-reactions. Thus, they were able to win Ismailis in Iraq and Iran as supporters. In the 1090s, as the political power of the Fatimids was waning, a group referred to as Nizaris broke away. The main aim of these "Assassins" under their leader Hasan-i Sabbah in the Iranian fortress Alamut was to attack the Seljuks as the leading force of the Sunni revival. In Ramadan 1164, Hasan-i Sabbah's great-grandson, Hasan II, led a notorious 'Great Resurrection,' during which the outer form of Islamic law (Arabic: zahir) was abolished in favor of its inner (Arabic: batin) dimension. After a celebration where wine was served and the fast violated, this antinomianism continued in a mild form for another fifty years.