It is the quality of being a monotheist in the face of paganism,3:67.
It appears to have been used earlier by Jews and Christians in reference to 'pagans' and applied to followers of an old Hellenized Syro-Arabian religion and was used to taunt early Muslims.
The term Hanif is used 12 times in the Quran;8 times in reference to Abraham(Ibrahim) who is the only person to have been explicity identified with the term.
Abraham(Ibrahim) is mentioned in the Quran as a Hanif, being a prophet predating the Judeo-Christian traditions, who rejected polytheism and pantheism for monotheism.
2: 135 They say: "Become JewsorChristiansif ye would be guided (to salvation)." Say thou: "Nay! (I would rather) the religion of Abraham the true [Hanifan] and he joined not gods with Allah."
3:67 "Ibrahim was neither a Jewnor aChristian but a 'Hanif', a Muslim, one who is not among the idol-worshippers."
3: 95Say: "Allah speaketh the truth: follow the religion of Abraham [Hanifan]the sane in faith; he was not of the pagans."
4: 125 Who can be better in religion than one who submits his whole self to Allah does good and follows the way of Abraham the true in faith [Hanifan]? For Allah did take Abraham for a friend.
10:104 Say: "O ye men! if ye are in doubt as to my religion (behold!) I worship not what ye worship other than Allah But I worship Allah Who will take your souls (at death): I am commanded to be (in the ranks) of the Believers.
This verse implies that Muhammad as being one of the Hanifs as well.
In Arabic,Abraham is called a Hanif meaning the True in Faith16:120;123.
16: 120Abraham was indeed a model devoutly obedient to Allah (and) true in faith [Hanifan] and he joined not gods with Allah:
123 So We have taught thee the inspired (message) "Follow the ways of Abraham the true in faith[Hanifan] he joined not gods with Allah."
Long before Muhammad, the Hanifs existed in Arabia as a distinct group who abhorred idolatory. To them, the kissing of the Black Stone was an act of pagan idolatory.
The Hanifs were an Arab sect that was very much influenced by the indigenous Jewish and Christian Arabswho have been in the Arabian Peninsula for centuries before Muhammad.
The Hanifs actuallypreceded Muhammad in their belief in the One and Only God of Abraham and exceeded him in their Monotheism by abhorring all aspects of pagan rituals and fetishes practiced by the pagan Arabs -the very same manifestations that Muhammad later incorporated into his version of 'Islam'.
The Muslim records themselves assert that Muhammad's first wife Khadijah was one of this sect - a Hanifa - as well as being related to her Christian uncle, Waraqa bin Nawfal.
According to the same records, they show that her influence and impact upon Muhammad's formative years - in his thoughts and psychology - were enormously important especially since he was originally an idolator himself.
Before Muhammad's repeated seclusion in the Hira cave, many Hanifs before him had done the same to contemplate the universe and concentrate their thoughts without interruptions in the hope of communing with the Almighty.
Muhammad only emulated his previous and contemporary Hanifs in finding solace and solitude and learning in one of these caves.
Another Hanif who had a great impact upon Muhammad as related by him in
Ibn Ishaq, was Zayd b Amr b Nufayl(Qurawayoun Manuscript p27, fos. 37b-38/Appendix B; Ibn Kathir p129 & p239; Suhayli p146) who upbraided him for eating meat sacrificed to idols.
It is a very illuminating fact that the documentation of personalities who are depicted as Hanifs but were hostile to Muhammad is both impressive and extensive.
Among the most famous Hanifs were:
Waraqa b. Nawfal;
Ubydullah b Jahsh;
Uthman b al Houwayreth;
Zayd b Amr b Nufayl.
There were also preachers, long before Muhammad, who appealed to the people in fervent verses and sermons to renounce idolatry -very similar to what Muhammad later on copied and used - such as:
Khaled b Senan;
Amer b Zared al Adwani;
Abdullah al Quda'I;
Hanzala b Safwan;
Qass b Sa'eda al Iyadi.
Umayya b abi Ssalt was a contemporary of Muhammad and a member of the Thaqif tribe at Ta'ef who was renowned for being a Hanif and a fervent advocate of monotheism.
Another pre Isalmic poet,Amr b Fadl - a while before Muhammad did the same - flatly rejected the famous idols of the paganArabs such as Al Uzza, Al Latt and Hubal.
Muhammad's'awakening' to the One and Only God was neither new nor unique. His immense contribution lies in the fact that he persevered against all odds and by using all means,however unsavoury and unsaintly, to jusify his ends until victory was his.
It is very pertinent to point out that many of the above and some of the pre Islamic poets used the name ALLAH for the 'Supreme Being' which indicates that the name Allah was known to them, so much so that Muhammad's father was called Abd Allah meaning the slave of Allah. That is why neither the Quran nor the Ahadith had to explain who and what Allah was.
*** It is a fact that Muhammad'sPOLEMIC in all of the Quran towards the pagan Arabs was NOT because they did not know AllahBUT onlybecause they ASSOCIATED other gods and goddesses with him ***