Sunan an-Nasa'i 4003
It was narrated from Ibn 'Abbas that :
Some people used to kill, and they did a great deal of it, and they used to commit adultery and they did a great deal of it, and they committed violations. They came to the Prophet [SAW] and said: "O Muhammad, what you say and call people to is good, if only you could tell us that there is any expiation for what we have done." Then Allah, the Mighty and Sublime, revealed: "And those who invoke not any other ilah (god) along with Allah up to for those, Allah will change their sins into good deeds," he said: "So Allah will change their Shirk into faith, and their adultery into chastity. And the Verse: "Say: O 'Ibadi (My slaves) who have transgressed against themselves (by committing evil deeds and sins)" was revealed.
أَخْبَرَنَا حَاجِبُ بْنُ سُلَيْمَانَ الْمَنْبِجِيُّ، قَالَ حَدَّثَنَا ابْنُ أَبِي رَوَّادٍ، قَالَ حَدَّثَنَا ابْنُ جُرَيْجٍ، عَنْ عَبْدِ الأَعْلَى الثَّعْلَبِيِّ، عَنْ سَعِيدِ بْنِ جُبَيْرٍ، عَنِ ابْنِ عَبَّاسٍ، أَنَّ قَوْمًا، كَانُوا قَتَلُوا فَأَكْثَرُوا وَزَنَوْا فَأَكْثَرُوا وَانْتَهَكُوا فَأَتَوُا النَّبِيَّ صلى الله عليه وسلم قَالُوا يَا مُحَمَّدُ إِنَّ الَّذِي تَقُولُ وَتَدْعُو إِلَيْهِ لَحَسَنٌ لَوْ تُخْبِرُنَا أَنَّ لِمَا عَمِلْنَا كَفَّارَةً ‏.‏ فَأَنْزَلَ اللَّهُ عَزَّ وَجَلَّ ‏{‏ وَالَّذِينَ لاَ يَدْعُونَ مَعَ اللَّهِ إِلَهًا آخَرَ ‏}‏ إِلَى ‏{‏ فَأُولَئِكَ يُبَدِّلُ اللَّهُ سَيِّئَاتِهِمْ حَسَنَاتٍ ‏}‏ قَالَ يُبَدِّلُ اللَّهُ شِرْكَهُمْ إِيمَانًا وَزِنَاهُمْ إِحْصَانًا وَنَزَلَتْ ‏{‏ قُلْ يَا عِبَادِيَ الَّذِينَ أَسْرَفُوا عَلَى أَنْفُسِهِمْ ‏}‏ الآيَةَ ‏.‏