religion. By the end of the third century Manichaeism reached the attention of the Roman Empire who viewed it as a “Persian aberration” with followers who were “despicable deviants”. Meanwhile, in Mesopotamia, rule was taken over by a new, less tolerant regime who imprisoned and executed Mani as an offender against Zoroastrian orthodoxy Consistent waves of persecution from Christians, Zoroastrians, and Muslims, Manichaeism was eventually eradicated as a formal religious affiliation within Byzantine and Islamicate realms. Manichaeism taught an elaborate dualistic cosmology describing the struggle between a good, spiritual world of light, and an evil, material world of darkness. Islam Islam has been the official religion and part of the governments of Iran since the Arab conquest of Iran 640 AD. It took another few hundred years for Shia Islam to gather and become a religious and political power in Iran. In the history of Shia Islam the first Shia state was Idrisid dynasty (780–974) in Maghreb, a region of north west Africa. Then the Alavids dynasty (864–928 AD) became established in Mazandaran (Tabaristan), in northern Iran. The Alavids were of the Zaidiyyah Shia (sometimes called "Fiver".) These dynasties were local. But they were followed by two great and powerful dynasties: Fatimid Caliphate which formed in Ifriqiya in 909 AD and the Buyid dynasty emerged in Daylaman, in north central Iran, about 930 AD and then extended rule over central and western Iran and into Iraq until 1048 AD. The Buyid were also Zaidiyyah Shia. Later Sunni Islam came to rule from the Ghaznavids dynasty (975–1187 AD) through to the Mongol invasion and establishment of the Ilkhanate which kept Shia Islam out of power until the Mongol ruler Ghazan converted to Shia Islam in 1310 AD and made it the state religion. The distinction between Shia groups have distinctions between Fiver, Sevener and Twelver, derived from their belief in how many divinely ordained leaders there were who are descendants of the Islamic prophet Muhammad through his daughter Fatimah and his son-in-law Ali. These Imams are considered the best source of knowledge about the Quran and Islam, the most trusted carriers and protectors of Muḥammad's Sunnah (habit or usual practice) and the most worthy of emulation. In addition to the lineage of Imams, Twelvers have their preferred hadith collections – The Four Books – which are narrations regarded by Muslims as important tools for understanding the Quran and in matters of