The various Shiʿa movements that have sprung up over the centuries trace their origins, obviously, to Ali ibn Abi Talib, the cousin and son in-law of Muhammad. But apart from that common origin there have (again, obviously) been a number of disagreements within the Shiʿa community over which line of descent from Ali was legitimate. These points of divergence can happen at any point along the family tree. Two of the tree largest extant Shiʿa branches, the Twelvers and the Ismaʿilis share the first several imams but break apart on the question of who succeeded Jafar al-Sadiq (d. 765). But through those shared early imams they both trace their lineages back to Ali through his second son (by Muhammad’s daughter Fatimah), Husayn.
There’s a whole other branch of Ali’s descendants via Husayn’s older brother, Hasan, who we don’t talk about as much, but they’ve also produced a number of Shiʿa imams. There’s Hasan himself of course, who’s generally considered Ali’s successor and the second (or first–some Shiʿa branches, like the Ismaʿilis start their numbering with him) imam. Zaydi Shiʿism, the third of the three largest extant Shiʿa branches, says that a descendant of either Hasan or Husayn can be imam, unlike the Twelvers and Ismaʿilis who don’t recognize any Hasanid imams apart from Hasan himself. A few prominent Sunni families–the Alaouite Dynasty of Morocco and the Hashemite Dynasty of Jordan, for example–also claim descent from Muhammad via Ali via Hasan. There are different titles for descendants of Ali via Hasan (they’re called sharif) and via Husayn (sayyid).
There’s no denying the fact that the Husaynids get the majority of historical attention unless you’ve got some really specialized interests–although to be fair, the fourth Twelver imam, Ali bin Husayn “Zayn al-Abidin,” married a cousin from Hasan’s line, so from his successor (Muhammad al-Baqir) on the Husaynid imams actually descend from both Husayn and Hasan. But historically, the two most significant Shiʿa ruling dynasties–the Fatimids and the Safavids–were Husaynid. And Husayn, not Hasan, was the one who died at Karbala in the single most formative event in the historical development of Shiʿism itself.
However, the Hasanids have had their moments of rebellion. For example, there was a Hasanid-led revolt in September 762, which was ultimately squashed by the Abbasids at the Battle of Bakhamra on January 21, 763. This is sometimes called a “Zaydi revolt,” since the Zaydis claim its leader as one of their imams, though that may be a bit over the top. The central figure in the 762 revolt was Muhammad al-Nafs al-Zakiyah (“Muhammad the Pure Soul,” and from this point on in this post when I refer to “Muhammad” it’s to him), a great-grandson of Hasan whose uprising was one of the first serious attempts by the early Shiʿa to push back against the Abbasids.
The Abbasids, if you recall, had come to power in part by skillfully playing upon the contempt in which the more religious members of the early Muslim community–scholars, for example, but also the early Shiʿa–had held the previous Umayyad dynasty. Once on the throne, the Abbasid caliphs–initially al-Saffah (d. 754) but by this time his brother and successor al-Mansur (d. 775)–wisely set about dismantling the coalition that had put them in power, lest it eventually turn on them. Murdering Abu Muslim, the general who had led their army in the civil war that brought them to power, was one important example of this project.
The Abbasids did make some reforms, and appointed key scholars to important jobs to bring them into the Abbasid tent. But they weren’t about to water down the absolutist qualities of the empire to satisfy reformers who wanted to see less power and decadence from their caliphs, and certainly they weren’t about to appease the early Shiʿa, who wanted to see Ali’s descendants on the throne, not these Abbasid dudes. So some rebellions were inevitable, and the Abbasids seem to have realized this and prepared for it.
Not much is known about Muhammad, although he apparently built up a devoted following in Medina (his epithet, “the pure soul,” certainly suggests that people thought highly of him). He was a great-grandson of Hasan whose father, Abdullah al-Mahd, came to the idea of armed resistance to the caliphate relatively late in life, after the death of Zayd b. Ali (the Zaydi namesake) in 740–hence the identification this revolt has with the Zaydi movement. Around the time of the Abbasid revolution circa 750, Abdullah started telling people that his son, Muhammad, was the Mahdi.
Muhammad and his younger brother, Ibrahim, are said to have gone incognito after the Abbasid takeover, traveling around the empire to stir up resistance to the new dynasty. In response, al-Mansur began arresting their relatives (including their father) and tossing them in prison, where many died (Abdullah died in 763, right around the time this rebellion was falling apart). Knowing that Kufa was the historic center of Alid resistance to the caliphs, al-Mansur made certain to keep tight control over that city. Consequently, Muhammad and Ibrahim decided to begin their revolt simultaneously in Medina, where Muhammad was popular, and in Basra, a city with some Alid sympathies and from where Ibrahim could be in position to take Kufa fairly quickly.
Once they split up, however, things started to go wrong. Muhammad declared his revolt in Medina in late September, well before Ibrahim was ready to do the same in Basra, and while he gained control of Medina pretty easily, that didn’t really mean all that much. Despite the fact that it had been the Prophet Muhammad’s capital and was still the caliphate’s regional capital in the Hejaz, Medina had long since stopped being of anything but symbolic importance from a military perspective. The city was too dependent on external supplies, which the Abbasids naturally cut off, to serve as the base of a rebellion, and its defenses were negligible. Al-Mansur sent a small army to retake the city, which Muhammad tried to defend by relying on the same trench system that the Prophet Muhammad had used back in 627. It seems that almost nobody thought this could possibly work, so they began to desert Muhammad al-Nafs al-Zakiyah in large numbers. And they were right–when the Abbasids arrived, on December 6 762, they laid boards over the trenches, entered the city, and slaughtered Muhammad and most of his remaining followers.
Ibrahim finally declared his revolt in Basra in late November, just before his brother was killed. He had some initial success, but this was partly because al-Mansur opted to bide his time, both to strengthen his forces in Kufa and to bring the force he’d sent to Medina north into Iraq. In January, a group of followers from Kufa convinced Ibrahim to march on that city before he was ready, and Ibrahim compounded the problem with his own indecision, choosing mid-march to stop and turn back toward Basra. His army camped for the night at Bakhamra, on the road between Kufa and Basra, where it was met and wiped out by the Abbasid army on (as near as anybody can tell) January 21, 763. Ibrahim escaped but was badly wounded–he died in mid-February, officially ending the rebellion. Al-Mansur spent the rest of his reign exacting retribution on the Shiʿa.