Simak bin Harb (may Allah have mercy on him) narrates, through Alqamah bin Wa'il bin Hujr, from his father, that a man attacked a woman in the darkness before dawn while she was heading to the mosque, and forced himself upon her. She called for help to a man who was passing by, and her attacker fled. Then a group of armed people passed by her and she called on them for help; they caught the man whose help she had sought, while the other (the attacker) got away from them. They brought him to the Prophet (peace and blessings be upon him), and the woman told him (peace and blessings be upon him) that this man had attacked her, and the people told him that they had caught him running. He said: I was only trying to help her against her attacker, but these people caught me. She said: He is lying; he is the one who assaulted me. The Messenger of Allah (peace and blessings be upon him) said: "Take him away and stone him." Then a man from among the people stood up and said: Do not stone him; I am the one who did this to her. So he confessed, and thus three people were gathered before the Messenger of Allah (peace and blessings be upon him): the one who assaulted her, the one who helped her, and the woman. He (peace and blessings be upon him) said: "You have been forgiven," and he also spoke kind words to the one who had helped her. Umar (may Allah be pleased with him) said: Stone the one who has confessed to fornication. The Messenger of Allah (peace and blessings be upon him) said: "Listen! He has repented to Allah with such a repentance that, if all the people of Yathrib had repented with it, it would have been accepted from them."
Hadith Referenceالمعجم الكبير للطبراني / باب الواو / 18238