Some people from among the polytheists had killed many and committed adultery often. They came to Muhammad ﷺ and said, "What you say and call us to is indeed good. If only you could tell us that there is an atonement for what we have done."Then this verse was revealed, "And those who do not invoke any other god alongside Allah, nor kill the soul that Allah has forbidden except by right, nor commit adultery" [Furqan 25:68].And this verse was also revealed, "Say, My servants who have transgressed against themselves, do not despair of the mercy of Allah. Indeed, Allah forgives all sins. Indeed, He is the Forgiving, the Merciful" [Zumar 39:53].
أن ناسا من أهل الشرك كانوا قد قتلوا وأكثروا، وزنوا وأكثروا، فأتوا محمدا ﷺ، فقالوا: إن الذي تقول وتدعو إليه لحسن، لو تخبرنا أن لما عملنا كفارة. فنزل: {والذين لا يدعون مع الله إلها آخر ولا يقتلون النفس التي حرم الله إلا بالحق ولا يزنون} [سورة الفرقان: ٦٨] ونزلت: {قل يا عبادي الذين أسرفوا على أنفسهم لا تقنطوا من رحمة الله إن الله يغفر الذنوب جميعا إنه هو الغفور الرحيم}
Bukhari reported it in the tafsir (4810), and Muslim in the book of 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. The wording given is that of Bukhari, and the wording of Muslim is similar.