Sahih Muslim | Book 7 | Hadith Number 2735

Narrated by Ka'b b. 'Ujra (Allah be pleased with him)
Ka'b b. 'Ujra (Allah be pleased with him) reported that the Messenger of Allah (may peace be, upon him) stood near him and lice were falling from his head. Thereupon he (the Holy Prophet) said: Do these vermin's trouble you? I said: Yes. Thereupon he said: Then shave your head; and it was in connection with me that this verse was revealed: "Whoever among you is sick or has an ailment of the head, he (may effect) a compensation by fasting or alms or a sacrifice". He (the Holy Prophet, therefore) said to me: Observe fast for three days or give a quantity of alms enough to feed six needy persons or offer sacrifice (of an animal) that is available.