Ħanīf (Arabic حنيف, plural ħunafā حنفاء) is an Islamic Arabic term that is now commonly believed to refer to people who rejected the idolatry during the (pre-Islamic) time of Jāhiliyya or "Ignorance".
The translation of ħanīf is "pre-Islamic monotheist (other than a Christian or a Jew)", referring to any person who was not poly- or pantheistic before the advent of Islam. It is an Arabic borrowing from the Syriac plural ħanfē "heathens, non-Christians".
According to Islamic belief, these people regularly spent some of their time away from the polytheist environment and made many retreats to nearby hills to pray. One such hill was Hira which is believed to be the location where Muhammad received his revelations from the Archangel Gabriel (Jibreel) which were later recorded as the Qur'an.
The only ħanīf mentioned by name in the Qur'ān is Ibrāħīm. Other Islamic sources such as the sīrat, ahādīth, and tafsīr go into further detail on the ħunafā. They are said to be Arabs who held to the "pure" religion of Ibrāħīm and were not seduced into polytheism. This includes the followers of Ibrāħīm and of his sons Ismā'īl (Ishmael) and Isħāq (Isaac).
Muslims are far from unanimous as to who was a ħanīf and how many ħunafā there were. Particularly divisive is the question of the status of Muħammad and his cousin ˤAlī. Shīˤa Muslims claim that Muħammad and ˤAlī were both ħunīfān from birth and that they were not sullied by participation in pagan rites.