When is a deed deemed righteous?
The Qur’an and the Sunnah make it plain that for any act to be righteous, accepted, and a means of drawing closer to Allah—glorified and exalted is He—it must fulfil two great and indispensable conditions. First, the doer must aim solely at the Face of Allah, seeking no one else. Second, the act must conform to what Allah has legislated in His Book or what His Messenger has set forth in his Sunnah. If either of these two conditions is lacking, the deed is neither righteous nor acceptable.
This is confirmed by His words: “So whoever hopes to meet his Lord—let him act righteously and associate none in the worship of his Lord.” 1 Here the Almighty commands that the deed be righteous—that is, in agreement with the Sunnah—and that it be performed purely for Allah alone.
Al-Hafiz Ibn Kathir comments in his Tafsir: “These are the two pillars of any deed that is accepted: it must be done sincerely for Allah and it must be correct, in accordance with the law brought by Allah’s Messenger, may Allah bless him and grant him peace.” Similar remarks are reported from Qadi ‘Iyad—may Allah have mercy on him—and others.