Some people who practiced shirk had killed many, and had committed fornication many times over. They came to Muhammad ﷺ and said, "What you say and call people to is beautiful, if only you could tell us that there is some atonement for what we have done."Then this was revealed, "And those who do not call upon another god along with Allah, nor kill the soul which Allah has forbidden except by right, nor commit fornication" [Furqan 25:68]. And this was revealed, "Say, my servants who have transgressed against yourselves, do not despair of Allah's mercy. Allah forgives all sins. He is indeed the Forgiving, the Merciful" [Zumar 39:53].
أن ناسا من أهل الشرك كانوا قد قتلوا وأكثروا، وزنوا وأكثروا، فأتوا محمدا ﷺ، فقالوا: إن الذي تقول وتدعو إليه لحسن، لو تخبرنا أن لما عملنا كفارة. فنزل: {والذين لا يدعون مع الله إلها آخر ولا يقتلون النفس التي حرم الله إلا بالحق ولا يزنون} ونزلت: {قل يا عبادي الذين أسرفوا على أنفسهم لا تقنطوا من رحمة الله إن الله يغفر الذنوب جميعا إنه هو الغفور الرحيم} [سورة الزمر: ٥٣].
Bukhari narrated it in the tafsir (4810), and Muslim in the faith (122), both of them through the route of Ibn Jurayj, who said, Yaala bin Muslim informed me, that he heard Saeed bin Jubayr narrating from Ibn Abbas, and he related it.