Sahih al-Bukhari, Hadith 4810 ⓘ
Narrated Ibn `Abbas: Some pagans who committed murders in great number and committed illegal sexual intercourse excessively, came to Muhammad and said, "O Muhammad! Whatever you say and invite people to, is good: but we wish if you could inform us whether we can make an expiration for our (past evil) deeds." So the Divine Verses came: 'Those who invoke not with Allah any other god, not kill such life as Allah has forbidden except for just cause, nor commit illegal sexual intercourse.' (25.68) And there was also revealed:-- 'Say: O My slaves who have transgressed against their souls! Despair not of the Mercy of Allah.' (39.53)
حَدَّثَنِي إِبْرَاهِيمُ بْنُ مُوسَى، أَخْبَرَنَا هِشَامُ بْنُ يُوسُفَ، أَنَّ ابْنَ جُرَيْجٍ، أَخْبَرَهُمْ قَالَ يَعْلَى إِنَّ سَعِيدَ بْنَ جُبَيْرٍ أَخْبَرَهُ عَنِ ابْنِ عَبَّاسٍ ـ رضى الله عنهما ـ أَنَّ نَاسًا، مِنْ أَهْلِ الشِّرْكِ كَانُوا قَدْ قَتَلُوا وَأَكْثَرُوا وَزَنَوْا وَأَكْثَرُوا، فَأَتَوْا مُحَمَّدًا صلى الله عليه وسلم فَقَالُوا إِنَّ الَّذِي تَقُولُ وَتَدْعُو إِلَيْهِ لَحَسَنٌ لَوْ تُخْبِرُنَا أَنَّ لِمَا عَمِلْنَا كَفَّارَةً. فَنَزَلَ {وَالَّذِينَ لاَ يَدْعُونَ مَعَ اللَّهِ إِلَهًا آخَرَ وَلاَ يَقْتُلُونَ النَّفْسَ الَّتِي حَرَّمَ اللَّهُ إِلاَّ بِالْحَقِّ وَلاَ يَزْنُونَ} وَنَزَلَ {قُلْ يَا عِبَادِيَ الَّذِينَ أَسْرَفُوا عَلَى أَنْفُسِهِمْ لاَ تَقْنَطُوا مِنْ رَحْمَةِ اللَّهِ}
also referenced under: Book 65, Hadith 4810 (In-Book) & Volume 6, Book 60, Hadith 334 (USC-MSA)