Narrated `Abdullah bin Maqal:
I sat with Ka`b bin Ujra in this mosque, i.e. Kufa Mosque, and asked him about the meaning of: "Pay a ransom (i.e. Fidya) of either fasting or . . . . (2.196)" He said, "I was taken to the Prophet (ﷺ) while lice were falling on my face. The Prophet (ﷺ) said, 'I did not think that your trouble reached to such an extent. Can you afford to slaughter a sheep (as a ransom for shaving your head)?' I said, 'No.' He said, 'Then fast for three days, or feed six poor persons by giving half a Sa of food for each and shave your head.' So the above Verse was revealed especially for me and generally for all of you."
USC-MSA web (English) reference: Vol. 6, Book 60, Hadith 42
Arabic reference: Book 65, Hadith 4517