The Alids are those who claim descent from Ali ibn Abi Talib (Arabic: عَلِيّ بْن أَبِي طَالِب; c. 600–661 CE), the fourth Rashidun caliph (r. 656–661) and the first imam in Shia Islam.
The main branches are the Hasanids and Husaynids, named after Hasan and Husayn, the eldest sons of Ali from his marriage to Fatima, the daughter of Muhammad.
[1] His first marriage was to Fatima, daughter of the Islamic prophet Muhammad, who bore Ali three sons, namely, Hasan, Husayn, and Muhsin, though the last one is not mentioned in some sources.
[1] Muhsin either died in infancy,[2] or was miscarried after Fatima was injured during a raid on her house to arrest Ali, who had withheld his pledge of allegiance from the first Rashidun caliph Abu Bakr (r. 632–634).
[4][14] In response, Shia doctrinally limited its leadership to the Alids, many of whom revolted against the Abbasids, including the Hasanid brothers Muhammad ibn Abd-Allah (d. 762) and Ibrahim.
[1][1] Some Alids instead took refuge in remote areas and founded regional dynasties in the southern shores of the Caspian sea, Yemen, and western Maghreb.
[4][15] For instance, the revolt of the Hasanid Husayn ibn Ali al-Abid was suppressed in 786 but his brother Idris (d. 791) escaped and founded the first Alid dynasty in Morocco.
[17] For example, their seventh imam, Musa al-Kazim (d. 799), spent years in the Abbasid prisons and died there, possibly poisoned by order of Caliph Harun al-Rashid (r. 786–809), who also had "hundreds of Alids" killed.
But other Abbasids revolted in opposition in Iraq, which forced al-Ma'mun to reverse his policies and Ali al-Rida died around that time, likely poisoned.
[19][20] Ali al-Hadi (d. 868) and Hasan al-Askari (d. 874), the tenth and eleventh imams of the Imamites, were held in the capital Samarra under strict surveillance.
[22] Their followers also believe that the birth of their twelfth imam, Muhammad al-Mahdi, was hidden for fear of Abbasid persecution and that he remains in occultation by divine will since 874, until his reappearance at the end of time to eradicate injustice and evil.