In Islamic teachings, the value of an action is determined by its intention. A good deed performed with a bad intention holds no divine reward and can even be considered a sin, as Allah is aware of what is in the hearts and sincerity is a condition for acceptance of deeds.
Your question about the value of a good deed performed with a bad intention delves into a profound ethical and theological discussion within Islamic teachings. In Islam, the concept of 'Niyyah' (intention) holds an incredibly significant and central position. The Prophet Muhammad (peace be upon him) famously stated, "Indeed, actions are by intentions." This noble Hadith, a foundational principle in Islamic jurisprudence and ethics, clearly indicates that the worth and validity of any action primarily depend on the individual's inner motive and purpose. The Holy Quran also emphasizes this truth in various ways, consistently highlighting that Allah observes the hearts and intentions, not merely the outward manifestations of deeds. When a good deed is performed with a bad intention, from an Islamic perspective, its spiritual value and divine reward are either nullified or severely diminished. For instance, if someone gives charity not out of a sincere desire to please God or help the needy, but rather to gain a reputation for generosity among people, this act of charity, while outwardly good and perhaps offering temporary benefit to the poor, carries no spiritual reward in the sight of Allah. In fact, due to the presence of 'Riya' (showing off) and hypocrisy, it might even be considered a sin. The Quran, in Surah Al-Baqarah, verse 264, states: "O you who have believed, do not invalidate your charities with reminders [of it] or [other] injury, like one who spends his wealth [only] to be seen by the people and does not believe in Allah and the Last Day. His example is like that of a [smooth] stone upon which is dust and then a downpour strikes it and leaves it bare. They are unable [to keep] anything of what they earned. And Allah does not guide the disbelieving people." This verse explicitly illustrates how hypocrisy and showing off can nullify a good deed, rendering it ineffective in terms of divine reward. It is crucial to understand that Allah is fully aware of what lies within human hearts; what transpires in one's innermost being is manifest to Him. The true value of an action lies not in its outward form, but in the spirit and essence of the intention behind it. Pure and sincere intention ('Ikhlas') is what bestows eternal worth and endurance upon a deed. Conversely, an impure intention, or one tainted by worldly motives, strips the action of its spiritual content. Actions performed to attract people's attention, gain fame, or achieve material benefits might yield worldly outcomes, but they will receive no share of divine reward in the afterlife. This distinguishes 'worldly benefit' from 'afterlife recompense'. An action with a bad intention might bring 'worldly' benefit to society or another individual (e.g., building a hospital for fame), but for the doer, it is worthless in terms of 'divine reward'. The importance of sincerity ('Ikhlas') in Islam is so profound that it is considered the soul and foundation of all acts of worship. Worship without sincerity is like a lifeless body. The Quran, in Surah Al-Bayyinah, verse 5, affirms: "And they were not commanded except to worship Allah, [being] sincere to Him in religion, inclining to truth, and to establish prayer and to give zakah. And that is the correct religion." This verse explicitly states that the primary purpose of creation and divine commandments is sincere worship. Sincerity in religion for Allah means sincerity of intention in all actions. The consequences of bad and hypocritical intentions are not limited to the absence of divine reward; they can also lead to punishment. This is because 'Riya' (showing off) is a subtle form of 'Shirk' (associating partners with Allah), meaning one attributes partnership to others alongside Allah in worship and obedience. A person who performs an action for the sake of people has essentially served people, not God. This truth will be revealed on the Day of Judgment, where human actions will be weighed according to their intentions. For instance, a famous Hadith Qudsi narrates that on the Day of Judgment, the first people to be cast into Hellfire will be a reciter of the Quran, a charitable person, and a martyr, all of whom performed their deeds for show and fame, not for the sake of Allah. This illustrates that even outwardly good deeds, if accompanied by impure intentions, can lead to adverse outcomes. Therefore, from the perspective of the Holy Quran, a good deed is only truly valuable when the intention behind it is also good and sincere. An action without sincere intention is like a body without a soul; although it may have an appealing outward appearance, it lacks true life and intrinsic worth. Allah Almighty is aware of the hearts and what is concealed within the chests, and He grants rewards based on the purity of intention and piety. Thus, one must constantly strive not only for actions to be outwardly good but also for them to be nourished by springs of pure and honest intentions, so that they may bear their true fruits in both this world and the Hereafter. The continuous struggle to purify one's intentions is a spiritual journey, requiring humility, self-awareness, and a constant turning towards Allah. This pursuit of sincere intent transforms mundane acts into profound spiritual experiences, ensuring that every effort, regardless of its scale, contributes to one's eternal well-being and proximity to the Divine.
O you who have believed, do not invalidate your charities with reminders [of it] or [other] injury, like one who spends his wealth [only] to be seen by the people and does not believe in Allah and the Last Day. His example is like that of a [smooth] stone upon which is dust and then a downpour strikes it and leaves it bare. They are unable [to keep] anything of what they earned. And Allah does not guide the disbelieving people.
And they were not commanded except to worship Allah, [being] sincere to Him in religion, inclining to truth, and to establish prayer and to give zakah. And that is the correct religion.
And remember the favor of Allah upon you and His covenant with which He bound you when you said, 'We hear and we obey.' And fear Allah. Indeed, Allah is Knowing of that within the breasts.
They say that in ancient times, a wealthy and renowned man built a magnificent and beautiful mosque. The mosque was so grand that everyone spoke of its splendor and greatness, praising the man. He himself enjoyed this commendation and inwardly expected a great reward from God. One day, an aged dervish, who was among the people of inner wisdom, was passing by the mosque. The wealthy man, with pride, asked him, "O Dervish, how do you see this mosque? Do you think with this deed, I have earned the pleasure of God and will have a good place in Paradise?" The dervish smiled and said, "O man, this structure, though beautiful in appearance, its stones are not built of sincerity, nor its bricks of love for God. Whoever wishes their deed to be accepted must first cultivate their heart before their hands. The value of an action lies in its intention, not in the grandeur of the edifice. If you have any intention in your heart other than gaining fame and the praise of people, all this effort will be but wind in your hand." The wealthy man was initially angered, but then he pondered and realized that the dervish spoke the truth and his intention for building the mosque was more for seeking people's praise than God's pleasure. From then on, he strove to perform his actions with purer intentions, seeking only the pleasure of the Truth.