Al-Bara' b. 'Azib reported
There happened to pass by Allah's Apostle (ﷺ) a Jew blackened and lashed. Allah's Apostle (ﷺ) called them (the Jews) and said: Is this the punishment that you find in your Book (Torah) as a prescribed punishment for adultery? They said: Yes. He (the Holy Prophet) called one of the scholars amongst them and said: I ask you in the name of Allah Who sent down the Torah on Moses if that is the prescribed punishment for adultery that you find in your Book. He said: No. Had you not asked me in the name of Allah, I would not have given you this information. We find stoning to death (as punishment prescribed in the Torah). But this (crime) became quite common amongst our aristocratic class. So when we caught hold of any rich person (indulging in this offence) we spared him, but when we caught hold of a helpless person we imposed the prescribed punishment upon him. We then said: Let us argree (on a punishment) which we can inflict both upon the rich and the poor. So We decided to blacken the face with coal and flog as a substitute punishment for stoning. Thereupon Allah's Messenger (ﷺ) said: O Allah, I am the first to revive Thy command when they had made it dead. He then commanded and he (the offender) was stoned to death. Allah, the Majestic and Glorious, sent down (this verse):" O Messenger, (the behaviour of) those who vie with one another in denying the truth should not grieve you..." up to" is vouchsafed unto you, accept it" (v. 41) 2176 It was said (by the Jews): Go to Muhammad; it he commands you to blacken the face and award flogging (as punishment for adultery), then accept it, but it he gives verdict for stoning, then avoid it. It was (then) that Allah, the Majestic and Great, sent down (these verses):" And they who do not judge in accordance with what Allah has revealed are, indeed, deniers of the truth" (v. 44) ;" And they who do not judge in accordance with what Allah has revealed-they, they indeed are the wrongdoers" (v. 45) ;" And they who do not judge in accordance with what God has revealed-they are the iniquitous (v. 47). (All these verses) were revealed in connection with the non-believers.