A man took liberties with a woman, meaning something short of fornication. I do not know exactly how far it went, only that it was less than zina. He came to the Prophet ﷺ and told him about it, and Allah, glorified is He, revealed, "Establish prayer at the two ends of the day and in the early hours of the night. Indeed, good deeds wipe away evil deeds. That is a reminder for those who remember" [Hud 11:114].The man asked, "Messenger of Allah, is this for me?"He replied, "It is for whoever acts upon it."
حدثنا سفيان بن وكيع حدثنا إسمعيل ابن علية عن سليمان التيمي عن أبي عثمان النهدي
أن رجلا أصاب من امرأة يعني ما دون الفاحشة فلا أدري ما بلغ غير أنه دون الزنا فأتى النبي ﷺ فذكر ذلك له فأنزل الله سبحانه {أقم الصلاة طرفي النهار وزلفا من الليل إن الحسنات يذهبن السيئات ذلك ذكرى للذاكرين} فقال يا رسول الله ألي هذه قال لمن أخذ بها
ReferenceBukhari narrated it in the Book of Prayer Times, Chapter on Prayer as an Expiation, no. 526, 4687, and Muslim in the Book of Repentance, Chapter on the Words of Allah Most High, "Indeed good deeds erase bad deeds", no. 2763, from the hadith of Sulayman, with the same chain.