'Abdullah b. Buraida reported on the authority of his father that Ma'iz b. Malik al-Aslami came to Allah's Messenger (ﷺ) and said
Allah's Messenger, I have wronged myself; I have committed adultery and I earnestly desire that you should purify me. He turned him away. On the following day, he (Ma'iz) again came to him and said: Allah's Messenger, I have committed adultery. Allah's Messenger (ﷺ) turned him away for the second time, and sent him to his people saying: Do you know if there is anything wrong with his mind. They denied of any such thing in him and said: We do not know him but as a wise good man among us, so far as we can judge. He (Ma'iz) came for the third time, and he (the Holy Prophet) sent him as he had done before. He asked about him and they informed him that there was nothing wrong with him or with his mind. When it was the fourth time, a ditch was dug for him and he (the Holy Prophet) pronounced judg- ment about him and he wis stoned. He (the narrator) said: There came to him (the Holy Prophet) a woman from Ghamid and said: Allah's Messenger, I have committed adultery, so purify me. He (the Holy Prophet) turned her away. On the following day she said: Allah's Messenger, Why do you turn me away? Perhaps, you turn me away as you turned away Ma'iz. By Allah, I have become pregnant. He said: Well, if you insist upon it, then go away until you give birth to (the child). When she was delivered she came with the child (wrapped) in a rag and said: Here is the child whom I have given birth to. He said: Go away and suckle him until you wean him. When she had weaned him, she came to him (the Holy Prophet) with the child who was holding a piece of bread in his hand. She said: Allah's Apostle, here is he as I have weaned him and he eats food. He (the Holy Prophet) entrusted the child to one of the Muslims and then pronounced punishment. And she was put in a ditch up to her chest and he commanded people and they stoned her. Khalid b Walid came forward with a stone which he flung at her head and there spurted blood on the face of Khalid and so he abused her. Allah's Apostle (ﷺ) heard his (Khalid's) curse that he had huried upon her. Thereupon he (the Holy Prophet) said: Khalid, be gentle. By Him in Whose Hand is my life, she has made such a repentance that even if a wrongful tax-collector were to repent, he would have been forgiven. Then giving command regarding her, he prayed over her and she was buried.