The command to purify our hearts from sin was an essential Islamic teaching ever since the early stages of the revelation in Makkah. This is known as 'purification of the soul' (tazkiyyat an-nafs).
Allah said: "He has succeeded who purifies the soul, and he has failed who corrupts the soul." (Qur'an, 91:9-10)
And Allah said: "A day when there will be no benefit in wealth or children, but only in he who comes to Allah with a pure heart." (Qur'an, 26:88-89)
We learn from these verses that our success in the Hereafter depends upon the purification of our hearts in this life. We must purify our hearts from spiritual sins such as greed, malice, envy, arrogance, and worldliness. In their place, we must adorn the heart with spiritual virtues such as generosity, compassion, benevolence, humility, and asceticism.
Purification of the heart was one of the first commands with which Moses (peace be upon him) was sent to Pharaoh.
Allah said: "Go to Pharaoh, for verily, he is a transgressor. Say to him: 'Will you purify yourself'?" (Qur'an, 79:17-18)
Purity of heart is also one of the defining characteristics of Abraham (peace be upon him).
Allah said: "Verily, among his people was Abraham, when he came to his Lord with a pure heart." (Qur'an, 37:83-84)
One of the primary methods we can use to purify our hearts is to perform sincere supplications and prayers according to the prophetic way (sunnah).
Allah said: "He has succeeded who purifies himself, who remembers the name of his Lord and prays." (Qur'an, 87:14-15)
When we exalt Allah and ask for our sins to be forgiven, this removes arrogance from our hearts and makes us humble. When we pray for Allah to guide others, this removes malice and hatred from our hearts and makes us love others for the sake of Allah. When we remember the Hereafter and the Day of Resurrection, this makes us less attached to the world and more inclined to help others.
In this way, the Messenger of Allah would purify his heart every morning and evening by performing supplications and prayers.
Anas ibn Malik reported: "The Messenger of Allah, peace be upon him, said to me: 'O boy, if you are able to remove every morning and evening any rancor from your heart toward anyone, then do so.' Then the Prophet said to me: 'O boy, that is my tradition and whoever revives my tradition, has loved me, and whoever loves me will be with me in Paradise'." (Sunan At-Tirmidhi, 2678)
The ritual prayer is meant to prevent us from committing sins and immoral deeds. Allah said: "Verily, the prayer prohibits immorality and wrongdoing, and the remembrance of Allah is greater." (Qur'an, 29:45)
Abu Huraira reported: "A man came to the Prophet, peace be upon him, and he said, 'Indeed, so-and-so prays in the night but he steals in the morning.' The Prophet said: 'Verily, it should prevent him from doing that'." (Musnad Ahmad, 9486)
The next method we can use to purify our hearts is to give in charity and perform good deeds for others. Allah said: "But the righteous one will avoid Hellfire, who gives from his wealth to purify himself." (Qur'an, 92:17-18)
And Allah said: "Take from their wealth a charity by which you cleanse them and purify them, and invoke blessings upon them." (Qur'an, 92:103)
When we give away our wealth in charity, this removes worldliness from our hearts and envy of what others have and it makes us hope for our good deeds stored in the Hereafter. Charity means not only giving wealth, but also giving people your time, your effort, your work, and even a smile or a kind word.
Jabir ibn Abdullah reported: "The Messenger of Allah peace be upon him said: 'Every good deed is charity. Verily, it is a good deed to meet your brother with a smiling face, and to pour what is left from your bucket into the vessel of your brother'." (Sunan At-Tirmidhi, 1970)
Charity is a duty upon every Muslim, for every person can give something from his wealth, time, and energy. At the very least, Muslims can refrain from harming others and that is also charity.
Abu Huraira reported: "The Messenger of Allah (peace be upon him) said: 'Charity is due upon every joint of the people for every day upon which the sun rises. Being just between two people is charity, and helping a man with his animal and lifting his luggage upon it is charity, and a kind word is charity, and every step that you take toward the mosque is charity, and removing harmful things from the road is charity'." (Sahih Muslim, 1009)
When a Muslim commits a sin, his or her heart is covered by a stain, but it is removed by repentance and good deeds.
Abu Huraira reported: "The Messenger of Allah (peace be upon him) said: 'Verily, when the believer commits a sin, a black spot appears upon his heart. If he repents and abandons the sin and seeks forgiveness, his heart will be polished, but if he increases in sin, the blackness increases. That is the covering which Allah has mentioned in his Book: 'Nay, but on their hearts is a covering because of what they have earned,' (83:14)" (Sunan ibn Majah, 4244)
Therefore, a Muslim must continue to perform supplications, prayers, charity, and good deeds until the heart is purified from sin.
In conclusion, the salvation of a Muslim depends upon purification of the heart soul from vices and adorning the heart with virtues. Purification is achieved through performing sincere supplications, prayers, and acts of charity toward others. We must remember that we will be judged on the Day of Resurrection according to the purity of our hearts and the righteousness of our deeds.
Abu Huraira reported: "The Messenger of Allah (peace be upon him) said: 'Verily, Allah does not look at your appearance or wealth, but rather He looks at your hearts and actions'." (Sahih Muslim 2564)
Success comes from Allah, and Allah knows best.