Some people from among the polytheists had killed many, committed adultery many times, and committed grave sins. They came to Muhammad ﷺ and said, "What you say and call to is indeed beautiful, if only you could tell us that there is some atonement for what we have done."So the verse was revealed, "And those who do not invoke another god alongside Allah, nor kill the soul which Allah has forbidden except by right, nor commit adultery" [Furqan 25:68].And the verse was revealed, "Say, My servants who have transgressed against themselves, do not despair of the mercy of Allah" [Zumar 39:53].
حدثني إبراهيم بن موسى أخبرنا هشام بن يوسف أن ابن جريج أخبرهم قال يعلى إن سعيد بن جبير أخبره
أن ناسا من أهل الشرك كانوا قد قتلوا وأكثروا وزنوا وأكثروا فأتوا محمدا ﷺ فقالوا إن الذي تقول وتدعو إليه لحسن لو تخبرنا أن لما عملنا كفارة فنزل {والذين لا يدعون مع الله إلها آخر ولا يقتلون النفس التي حرم الله إلا بالحق ولا يزنون} ونزلت {قل يا عبادي الذين أسرفوا على أنفسهم لا تقنطوا من رحمة الله}