Narated By Al-Bara’ ibn Azib : The people passed by the Apostle of Allah (PBUH) with a Jew who was blackened with charcoal and who was being flogged.
He called them and said: Is this the prescribed punishment for a fornicator?
They said: Yes. He then called on a learned man among them and asked him: I adjure you by Allah Who revealed the Torah to Moses, do you find this prescribed punishment for a fornicator in your divine Book?
He said: By Allah, no. If you had not adjured me about this, I should not have informed you. We find stoning to be prescribed punishment for a fornicator in our Divine Book. But it (fornication) became frequent in our people of rank; so when we seized a person of rank, we left him alone, and when we seized a weak person, we inflicted the prescribed punishment on him. So we said: Come, let us agree on something which may be enforced equally on people of higher and lower rank. So we agreed to blacken the face of a criminal with charcoal, and flog him, and we abandoned stoning.
The Apostle of Allah (PBUH) then said: O Allah, I am the first to give life to Thy command which they have killed. So he commanded regarding him (the Jew) and he was stoned to death.
Allah Most High then sent down: “O Apostle, let not those who race one another into unbelief, make thee grieve…” up to “They say: If you are given this, take it, but if not, beware!….” up to “And if any do fail to judge by (the light of) what Allah hath revealed, they are (no better than) unbelievers,” about Jews, up to “And if any do fail to judge by (the right of) what Allah hath revealed, they are no better than) wrong-doers” about Jews: and revealed the verses up to “And if any do fail to judge by (the light of) what Allah hath revealed, they are (no better than) those who rebel.” About this he said: This whole verse was revealed about the infidels.