The Messenger of Allah ﷺ said: If anyone who is sexual defiled leaves a spot equal to the breadth of a hair without washing, such and such an amount of Hell-fire will have to be suffered for it. Ali said: On that account I treated my head (hair) as an enemy, meaning I cut my hair. He used to cut the hair (of his head). May Allah be pleased with him.
أَنَّ رَسُولَ اللَّهِ ﷺ قَالَ مَنْ تَرَكَ مَوْضِعَ شَعْرَةٍ مِنْ جَنَابَةٍ لَمْ يَغْسِلْهَا فُعِلَ بِهِ كَذَا وَكَذَا مِنَ النَّارِ قَالَ عَلِيٌّ فَمِنْ ثَمَّ عَادَيْتُ رَأْسِي فَمِنْ ثَمَّ عَادَيْتُ رَأْسِي ثَلاَثًا وَكَانَ يَجِزُّ شَعْرَهُ