Before a Muslim moves another step forward or performs any act or deed, he is obliged to acquire knowledge in the path that will lead him to the best end, that is, having his good deeds accepted by Allah, Allah willing. It is important to note that what counts is not the number of good deeds or acts of worship performed, for there may be a person who performs many good deeds, yet, all what he gains is tiredness in this life and hardships in the Last Life. The Messenger said, what translated means, “There may be a Sa’im (fasting person) who only gains hunger from his Siyam (fast), and there may be a Qa’im (who stands up in prayer at night) who only gains Sahar (staying up late) from his Qiyam!” [Ibn Majah]. Rather, what truly counts is knowing and implementing the conditions that will ensure Allah’s acceptance of the performed good deeds and various acts of worship.
There are two essential conditions that must both be present in every performed good act or deed, so as to ensure their acceptance by Allah. First, a Muslim must seek Allah alone in the good deeds that he performs. Second, this good deed must be in total accordance with what Allah has legislated in His Book and what His Messenger has commanded in his Sunnah.
Whenever one of those two conditions is absent from any righteous act or deed, then this good deed or act is neither good nor accepted, for Allah said, what translated means, “So whoever hopes for the meeting with his Lord, let him work righteousness and associate none as a partner in the worship of his Lord.” [18:110]
In this Ayah, Allah has decreed that any good act or deed must be righteous, that is, being in accordance with His Religion, and that He alone is sought by this good act or deed.
In his Tafsir (explanation) of the Quran, ibn Kathir said, “these are the two conditions that ensure the acceptance of any righteous act: it must be performed for the sake of Allah alone and according to the Sunnah of the Messenger of Allah.”