A group of people had killed and been excessive in killing, had committed adultery and been excessive in doing so, and had committed heinous crimes. They came to the Prophet (peace be upon him) and said: “O Muhammad! What you say and what you call towards is something good. If only you could inform us of some atonement for what we have done.”
Then Allah revealed: “And those who do not invoke any other god along with Allah…” up to the point “...Allah will change their evil deeds to good deeds.”
The Prophet (peace be upon him) said: “Allah will change your polytheism to belief and your adultery to chastity.”
Also revealed at this time was: “Say: O my Servants who have transgressed against their souls! Despair not of the Mercy of Allah: for Allah forgives all sins: for He is Oft-Forgiving, Most Merciful.” [ Sahîh al-Bukhârî (3855) and Sahîh Muslim (122)]
The conditions of repentance, as can be understood from the texts, are as follows:
1. Abstinence from committing the sin
2. A firm resolve never to return to the sin
3. Regret for having committed the sin in the first place
If his sin involved any injury to another party, then one or both of the following two conditions may apply:
4. Restoring the rights of others that may have been violated
5. Redressing the wrong or the injury that he may have inflicted upon others
There are those who transgress the limits of Allah and die in such a state without ever bothering to repent for their sins, or who offer repentance without fulfilling its conditions. They meet their Lord carrying their sins upon their backs unatoned for, and when their deeds are weighted in the balance, their evil deeds outweigh the good that they have done.
Abû Hurayrah relates how the Prophet (peace be upon him) described such people to his Companions:
Allah's Messenger (peace be upon him) asked: “Do you know who is bankrupt.”
They replied: “The bankrupt person is one who has no silver coin and no provision.”
He said: “In fact, the bankrupt person from among my people is the one who comes to the Day of Resurrection with prayers, fasts, and charity to his credit, but he had spoken ill of someone, slandered someone else, misappropriated someone's money, shed someone's blood, and assaulted someone else. Thereupon his good deeds will be given over to this one and to that one. If his good deeds run out before his account is complete, then some of their evil deeds will be taken and cast upon him. Then he will be cast into the Fire.” [ Sahîh Muslim (2581)]
The Prophet (peace be upon him) also said: “Whoever has upon his account some injustice that he has perpetrated against his brother, then he should free himself from it, for there will be no gold or silver coin (in the Hereafter) that will avail him against his good deeds being taken from him and given to his brother. And if he has no good deeds, then his brother's sins will be taken and foisted upon him.” [ Sahîh al-Bukhârî (6534)]
Worse than that are those who commit evil deeds while construing them as lawful, who feel secure in what they are doing from Allah's scheme and His punishment.
Thawban relates a discussion the Prophet (peace be upon him) had with him wherein he describes some people whose transgression against Allah's limits is most severe:
The Prophet (peace be upon him) said: “I know of a people from within my Ummah who will come on the Day of Resurrection with good deeds like the Tihama Mountains in quantity, pure and white. Allah will make those deeds like dust scattering in the wind.”
Thawban then said: “O Messenger of Allah! Describe them to us. Make them known to us so that we will not be of them without realizing it.”
He said: “They are your brethren and your countrymen. They take from their nights (for prayer) as you do. However, they are people who when they are alone with the limits of Allah, they violate them.” [ Sunan Ibn Mâjah (4235) – authenticated by al-Bûsîrî]
And Allah is the one who grants success and who guides to the path of true guidance.