Jami` at-Tirmidhi, Book 47, Hadith 3237 (In-Book)

Narrated Mujahid: that Ka'b bin 'Ujrah said: "By the one in Whose Hand is my soul! This Ayah was revealed referring to my case: 'And whosoever of you is ill or has an ailment on his scalp (necessitating shaving) he must pay Fidyah of either fasting or giving charity, or a sacrifice. (2:196)'" He said: "We were with the Messenger of Allah at Al-Hudaibiyyah and we were in a state of Ihram. The idolaters had held us back, and I had a good deal of hair, and the lice were falling on my face. The Prophet passed by me and said: 'The lice on your head are bothering you?'" He said: "I said: 'Yes.' He said: 'Then shave.' And this Ayah was revealed." Mujahid said: "The fasting is for three days, the feeding is six needy people, and the sacrifice is a sheep or more."

حَدَّثَنَا عَلِيُّ بْنُ حُجْرٍ، أَخْبَرَنَا هُشَيْمٌ، أَخْبَرَنَا مُغِيرَةُ، عَنْ مُجَاهِدٍ، قَالَ قَالَ كَعْبُ بْنُ عُجْرَةَ وَالَّذِي نَفْسِي بِيَدِهِ لَفِيَّ أُنْزِلَتْ هَذِهِ الآيَةُ وَإِيَّاىَ عَنَى بِهَا ‏:‏ ‏(‏فَمَنْ كَانَ مِنْكُمْ مَرِيضًا أَوْ بِهِ أَذًى مِنْ رَأْسِهِ فَفِدْيَةٌ مِنْ صِيَامٍ أَوْ صَدَقَةٍ أَوْ نُسُكٍ ‏)‏ قَالَ كُنَّا مَعَ النَّبِيِّ صلى الله عليه وسلم بِالْحُدَيْبِيَةِ وَنَحْنُ مُحْرِمُونَ وَقَدْ حَصَرَنَا الْمُشْرِكُونَ وَكَانَتْ لِي وَفْرَةٌ فَجَعَلَتِ الْهَوَامُّ تَسَاقَطُ عَلَى وَجْهِي فَمَرَّ بِيَ النَّبِيُّ صلى الله عليه وسلم فَقَالَ ‏"‏ كَأَنَّ هَوَامَّ رَأْسِكَ تُؤْذِيكَ ‏"‏ ‏.‏ قَالَ قُلْتُ نَعَمْ ‏.‏ قَالَ ‏"‏ فَاحْلِقْ ‏"‏ ‏.‏ وَنَزَلَتْ هَذِهِ الآيَةُ ‏.‏ قَالَ مُجَاهِدٌ الصِّيَامُ ثَلاَثَةُ أَيَّامٍ وَالطَّعَامُ سِتَّةُ مَسَاكِينَ وَالنُّسُكُ شَاةٌ فَصَاعِدًا ‏.‏

sunnah.com