For a deed to be accepted by God, two essential pillars must be present: the intrinsic goodness of the deed itself and the righteousness of the doer. This means that the act must be inherently virtuous, capable of drawing one closer to God, and performed by someone of a pure heart and genuine faith. Only then does God accept and approve of such deeds, as the Qur’an emphasizes: “God only accepts from the righteous” (Qur’an 5:27).
The level of righteousness needed for acceptance, as indicated in this verse, is not absolute. Complete righteousness in all aspects is not a prerequisite for a deed’s basic acceptance; otherwise, most people’s actions would be disqualified. Instead, complete righteousness—where the doer is just in every regard—is required for perfect acceptance, not as a minimum standard.
Thus, a deed performed with the necessary conditions and without barriers may be accepted, even if the doer does not possess full righteousness in every area. However, certain fundamental beliefs, such as accepting the guardianship (wilāya) of the Imams, are essential for deeds to be accepted in Islam. Many narrations affirm that if one dedicates their life to worship but rejects the guardianship of the Infallible Imams, none of their deeds will be accepted.
Any deed that lacks one or both of these essential pillars—the goodness of the act and the righteousness of the doer—will not be accepted. Regarding the hypocrites, who are fundamentally corrupt and lack true goodness, God describes how all their actions, even devotional ones, are empty of divine intent: “They do not believe in God and His Messenger, and they do not come to prayer except lazily, and they do not spend except reluctantly” (Qur’an 9:54). Hence, God does not accept their deeds: “Say, ‘Spend willingly or unwillingly; it will never be accepted from you. Indeed, you have been a defiantly disobedient people.’ And what prevents their expenditures from being accepted from them is not but that they have disbelieved in God and in His Messenger and that they come not to prayer except while they are lazy and that they do not spend except while they are unwilling” (Qur’an 9:53-54).
Nevertheless, in His grace and mercy, God accepts the righteous deeds of a virtuous person, even if they have some shortcomings. He overlooks deficiencies and forgives faults, as reflected in the verse: “Indeed, those who have said, ‘Our Lord is God,’ then remained on a right course—there will be no fear concerning them, nor will they grieve. … Those are the ones from whom We will accept the best of what they did and overlook their misdeeds, [their being] among the companions of Paradise. [This is] the promise of truth which they had been promised” (Qur’an 46:13-16).
In summary, acceptance by God hinges on the inherent goodness of the deed and the spiritual purity of the doer, recognizing that while perfection in righteousness is ideal, God’s mercy allows for acceptance of sincere efforts even when some flaws remain.
Reference: Tafsir al-Tasnim (under verse 2:127)