Muhammad ibn al-Hanafiyya

Muhammad ibn al-Hanafiyya (مُحَمَّد ابْن الْحَنَفِيَّة, c. 637–700, 15–81 AH) was a son of Ali ibn Abi Talib, who was the fourth caliph in Sunni Islam ((r. 656 – 661)) and the first imam in Shia Islam. Ibn al-Hanafiyya was an effective lieutenant for his father Ali during his caliphate. After the assassination of Ali and the deaths of his two sons Hasan and Husayn, many recognized Ibn al-Hanafiyya as the head of the House of Ali. Claiming to represent Ibn al-Hanafiyya, Mukhtar al-Thaqafi rose in Iraq in 686 to avenge Husayn and his relatives, who were massacred in 680 CE by forces of the Umayyad caliph Yazid bin Mu'awiya ((r. 680 – 683)). The quiescent Ibn al-Hanafiyya did not actively associate with this rebellion but was still rescued by Mukhtar when he was detained by the rival caliph Ubayd Allah ibn Ziyad. Support for Ibn al-Hanafiyya continued even after the defeat and death of Mukhtar in 686–687 in the form of the Kaysanites, a now-extinct Shia sect that traced the imamate to Ibn al-Hanafiyya and his descendants, particularly his son Abu Hashim. After the death of Ibn al-Hanafiyya in 700–701, some Kaysanites declared that he was the Mahdi, the eschatological Islamic leader who would reappear in the end of time and eradicate injustice and evil. The Kaysanites later provided the organizational structure for the Abbasids to overthrew the Umayyads in 750–751.

Birth
Often known by his title Ibn al-Hanafiyya, Muhammad was born to Khawla bint Ja'far, a woman from the Banu Hanifa tribe, and Ali ibn Abi Talib, a cousin of the Islamic prophet Muhammad. Ali is also recognized as the fourth Rashidun caliph ((r. 656 – 661)) and the first Shia imam. Ibn al-Hanafiyya was either born in 16 AH (637–638 CE), or circa 633. He was the only child of Khawla, a freed slave, whom Ali had married sometime after the death of his first wife Fatima, daughter of Muhammad. The kunya of Ibn Hanafiyya was Abu al-Qasim.

Early life
Soon after the assassination of the third Rashidun caliph Uthman ibn Affan ((r. 644 – 656)), Ali was elected to the caliphate in Medina. During his caliphate, Ibn al-Hanafiyya accompanied Ali in battles, as his champion and standard-bearer. When Ali was assassinated in Kufa in January 661, his eldest son Hasan was elected caliph there, but later abdicated in favor of Mu'awiya I ((r. 661 – 680)) in August 661. Hasan died in 669 in Medina, probably poisoned at the instigation of Mu'awiya, who thus paved the way for the succession of his son Yazid I ((r. 680 – 683)) often portrayed by Muslim historians as impious and immoral. Hasan was thus succeeded by his younger brother Husayn as the head of Muhammad's family. When the Umayyad Marwan and the prophet's widow Aisha prevented the burial of Hasan near his grandfather, Ibn Hanafiyya is said to have convinced Husayn to bury their brother in the Baqi Cemetery.

Battle of Karbala
Upon Mu'awiya's death and Yazid's accession in 680, the latter instructed his governor of Medina to secure Husayn's pledge of allegiance by force. Husayn immediately left for Mecca to avoid recognizing Yazid as the caliph. There Husayn received some letters of support from Kufans, whose intentions were verified by his envoy, Muslim ibn Aqil. Among many others, Ibn al-Hanafiyya is said to have warned Husayn not to trust the Kufans, who had betrayed their father Ali and their brother Hasan, suggesting that he should instead stay in Mecca or conceal himself in Yemen. Husayn ignored such warnings, saying that he expected to be killed while fighting the tyranny of Yazid. On their way to Kufa in 680, Husayn's small caravan was intercepted by the Umayyad army. He was killed in the ensuing Battle of Karbala, alongside most of his male relatives and his small retinue, having been surrounded for some days and deprived of the drinking water of the nearby Euphrates River. After the battle, the women and children in Husayn's camp were taken prisoner and marched to the Umayyad capital Damascus in Syria. The promised Kufan support did not materialize as Ubayd Allah ibn Ziyad, the new governor of Kufa, killed Husayn's envoy and intimidated Kufan tribal chiefs. Unlike Husayn, the quiescent Ibn al-Hanafiyya is said to have pledged his allegiance to Yazid.

Uprising of Mukhtar
After the death of Husayn, his only surviving son, Ali ibn Husayn Zayn al-Abidin, retired to an apolitical life in Medina. Ibn al-Hanafiyya was thus considered by many as the head of the House of Ali. Indeed, Mukhtar al-Thaqafi soon claimed to represent Ibn Hanafiyya in Kufa, calling for revenge for the Karbala massacre. His efforts were bolstered by the defeat of the alternative Tawwabun rebellion in 684. Mukhtar eventually seized control of Kufa in 686 from Abd Allah ibn Zubayr, who had established in 680 an alternative caliphate in Mecca that rivaled the Umayyads. It is doubtful that Mukhtar actually represented the quiescent Ibn Hanafiyya. Nevertheless, the noncommittal response of Ibn Hanafiyya was interpreted by a Kufan delegation as an implicit endorsement of Mukhtar, which in turn strengthened the Kufans' support for the latter.

Mahdi
After Husayn's death, Mukhtar likely considered Ibn Hanafiyya as the rightful imam, referring to him as Ali's surviving wasi (lit. 'legatee') after Hasan and Husayn. Mukhtar also referred to Ibn Hanafiyya as the Mahdi (lit. 'the rightly-guided one'), that is, the leader who would deliver Muslims from oppression and spread justice. At this point, however, this title of Ibn Hanafiyya probably did not have any messianic implications. At any rate, Ibn Hanafiyya is said to have avoided this title, as he remained in his hometown of Medina and declined active leadership of the revolution. Perhaps an indication of his equivocal attitude towards the rebellion, Ibn Hanafiyya is said to have been represented in some later Hajj pilgrimages by his personal flag as the head of the House of Ali.

Avenging Husayn
True to his promise, Mukhtar killed several figures thought to be responsible for the Karbala massacre, including the Kufa governor Ibn Ziyad and the Umayyad commander Umar ibn Sa'd, whose head was then sent to Ibn al-Hanafiyya by some accounts. Also killed was Shamir ibn Dhi al-Jawshan, often viewed as responsible for beheading Husayn in Karbala. Elsewhere, Murra ibn Munqidh al-Abdi survived a revenge attempt but was severely wounded. He is said to have killed Husayn's son Ali al-Akbar. Yet Asma ibn Kharija al-Fazari and Muhammad ibn al-Ash'ath al-Kindi escaped Mukhtar unharmed. The former was sought for his role in killing Muslim ibn Aqil and the latter was accused of insulting Husayn in Karbala.

Confrontation with Ibn al-Zubayr
Saying that he was waiting for communal consensus, Ibn Hanafiyya had refused to pledge his allegiance to Ibn al-Zubayr, the self-proclaimed caliph in Mecca. Some have therefore suggested that Ibn al-Hanafiyya might have had his own ambitions for the high office. Perhaps it was this refusal to take the oath of allegiance and the takeover of Kufa by Mukhtar that provoked the Meccan caliph to imprison Ibn Hanafiyya. He now wrote to Mukhtar for help and was rescued by his military detachment(s). The rescue mission is said to have been bloodless, as Ibn Hanafiyya had forbidden Mukhtar's men from fighting in the sanctuary of Mecca. This appeal for help suggests that the passive attitude of Ibn Hanafiyya towards Mukhtar has been exaggerated. Ibn Hanafiyya then settled in Mina, near Mecca, and later in Ta'if.

Death of Mukhtar
Mukhtar was defeated and killed in 686–687, yet Ibn Hanafiyya was not compromised afterward, which perhaps indicates his weak ties with Mukhtar. Ibn Hanafiyya continued to withhold his support from the two rival caliphates until the fall of Zubayr in 692, at which point he pledged his allegiance to the Umayyad caliph Abd al-Malik ((r. 685 – 705)). By some accounts, he visited the caliph in Damascus in 692, and who generously compensated him.

Kaysanites
The now-extinct Kaysanites was a Shia sect that traced the imamate to Ibn Hanafiyya and his descendants. The sect emerged from the uprising of Mukhtar, whose death did not end the propaganda in favor of Ibn Hanafiyya. The Kaysanites condemned the caliphs preceding Ali ibn Abi Talib as usurpers of his right to succeed the Islamic prophet Muhammad. Most of them regarded Hasan, then Husayn, and finally Ibn Hanafiyya as the divinely-appointed imams after Ali ibn Abi Talib. When Ibn Hanafiyya died in 700–701, or in 703 or 705, most Kaysanites followed his son Abu Hashim, but some thought that Ibn Hanafiyya had entered occultation, that is, he was providentially concealed from mankind until his reappearance by divine will. This was perhaps when the concept of the Mahdi became mainstream as the eschatological Islamic leader who would eradicate injustice and evil in the end of time. Being the last (notable) son of Ali, the death of Ibn Hanafiyya also further divided the Shia community.

It is difficult to estimate the numerical strength of the Kaysanites. Late during the Umayyad period, they likely outnumbered the imamite Shias, who followed a Husaynid line of imams. Indeed, Ibn Hanafiyya and later his successor Abu Hashim diverted considerable support from Ali Zayn al-Abidin and his successor Muhammad al-Baqir, for neither of the two laid any public claims to the imamate. The movement of Mukhtar ultimately paved the way for the overthrow of the Umayyads, as the Kaysanites provided the organizational structure for the successful rebellion of the Abbasids, who claimed descent from Muhammad's paternal uncle, Abbas. They postulated that Abu Hashim was succeeded to the imamate by the head of the Abbasid family, Muhammad ibn Ali. This was apparently the main Abbasid claim to legitimacy until they declared around 780 that the heir of the Islamic prophet Muhammad was his uncle Abbas rather than his cousin and son-in-law, Ali ibn Abi Talib. The Abbasids thus gradually turned against the mainstream Shia, carrying with themselves large numbers of the Kaysanites to Sunnism.