jurisprudence. For Twelvers the lineage of Imams are known as the Twelve Imams. Of these Imams, only one is buried in Iran – at the Imam Reza shrine, for Ali ar-Ridha who lived from 765 to 818 AD, before any Shi'a dynasties arose in Iran. The last Imam recognized by Twelvers, Muhammad al-Mahdi, was born in 868 AD as the Alavids spread their rule in Iran while in conflict with Al-Mu'tamid, the Abbasid Caliph at the time. Several Imams are buried in Iraq, as sites of pilgrimage, and the rest are in Saudi Arabia. In addition two of the Five Martyrs of Shia Islam have connections to Iran – Shahid Thani (1506–1558) lived in Iran later in life, and Qazi Nurullah Shustari (1549–1610) was born in Iran. The predominant school of theology, practice, and jurisprudence (Madh'hab) in Shia Islam is Jafari established by Ja'far as-Sadiq. There is also a community of Nizari Ismailis in Iran who recognise Aga Khan IV as their Imam. Although Shias have lived in Iran since the earliest days of Islam, and there had been Shia dynasties in parts of Iran during the 10th and 11th centuries, according to Mortaza Motahhari the majority of Iranian scholars and masses remained Sunni until the time of the Safavids. However, there are four high points in the history of Shia in Iran that expanded this linkage: First, the migration of a number of persons belonging to the tribe of the Ash'ari from Iraq to the city of Qum towards the end of the 7th century AD, which is the period of establishment of Imami Shi‘ism in Iran. Second, the influence of the Shia tradition of Baghdad and Najaf on Iran during the 11th to 12th centuries AD. Third, the influence of the school of Hillah on Iran during the 14th century AD. Fourth, the influence of the Shi‘ism of Jabal Amel and Bahrain on Iran during the period of establishment of the Safavid rule. In 1501, the Safavid dynasty established Twelver Shia Islam as the official state religion of Iran. In particular after Ismail I captured Tabriz in 1501 and established Safavids dynasty, he proclaimed Twelver Shiʿism as the state religion, ordering conversion of the Sunnis. The population of what is nowadays Azerbaijan was converted to Shiism the same time as the people of what is nowadays Iran. Although conversion was not as rapid as Ismail's forcible policies might