Muḥammad ibn al-Ḥanafiyyah (born 637—died 700/701, Medina, Arabia [now in Saudi Arabia]) was a Muslim religious figure who many thought was the legitimate caliph. He was a son of ʿAlī, the fourth caliph, but not by his wife, Fāṭimah, who was the daughter of the Prophet Muhammad. By nature, Muḥammad ibn al-Ḥanafiyyah was retiring and inclined to avoid partisan strife; he acted with much caution despite the support of various factions that would have made him caliph. He eventually pledged allegiance to the Umayyad caliph ʿAbd al-Malik, from whom he received a large annual pension.