The Islamic scholars have said that for an act of ibadah (worship) to be deemed correct, it must meet two conditions: sincerity (ikhlas) and in accordance with how Prophet Muhammad did it (muwafaqah sunnah).
The action has to be sincere, purely seeking the Face of Allâh – the Most High – because Allâh says: “Say (O Muhammad sal-Allâhu ‘alayhe wa sallam): Verily I am only a man like yourselves, but revelation has been revealed to me that the One whom you should worship is only One Deity. And whoever hopes to meet his Lord, let him do righteous actions; and in the worship of your Lord, do not associate anyone along with Him.” [Sûrah Kahf 18:110].
Shaykh Nasirudeen Al-albane said: “This means that the person seeks, by his righteous action, only the Face of Allâh – the Exalted and Sublime. However, if he seeks other than Allâh, then he has setup partners with Allâh (made shirk with Allâh), therefore his action is rejected. “This is further confirmed by Allâh in an authentic hadeth Qudse:
“I am so self-sufficient that I am in no need of having any partners. Thus, whosoever does an action for the sake of someone else as well as Me, will have that action rejected by Me, to him whom he associated with Me.” [Related by Muslim (no.2985) and Ibn Mâjah (no.4202) – from Abû Hurayrah (radi-Allâhu ‘anhu)]
“Consequently, if the action is righteous but not sincere for the sake of Allâh’s Face, it is rejected. Moreover, if the action is purely for the sake of Allâh’s Face, but not in accordance with the Sunnah, it is likewise not accepted”, said the foremost hadeth scholar.
Also, if the action is done as an act of worship, but is not in accordance with the Sunnah (the way the Prophet ordered us to do it) , it is not a righteous action. The reason is that compliance with the Sunnah is one of the conditions for the action’s righteousness. The proofs of this are many, but it is enough to state one: The hadîth of the Prophet (sal-Allâhu ‘alayhe wa sallam) in which he said:
“Whoever innovates in this matter of ours what is not upon it, it shall be rejected.” [Related by al-Bukhârî (5/301) and Muslim (no.1718) – from ‘A’ishah (radi-Allâhu ‘anhâ)]
Therefore, any action that was not part of Islâm when Allâh revealed it to the Prophet Muhammad (sal-Allâhu ‘alayhe wa sallam) is not a righteous action. About this, Allâh – the Most High – says: “This day I have perfected your Deen for you and completed My favour upon you and I have chosen Islâm as your Deen.” [Sûratul-Mâ’idah 5:3]
So these are the two conditions for every action to be a righteous action. If one of these conditions is not present, the action does not become a righteous action, it becomes an evil one. Had the person not done this action, it would have been better for him.
If a man prays two rak’ât of prayer at night, while others sleep, then even if he prays them according to the Sunnah – without addition or deletion – but he does this so that people may talk about him and say: “This Person is a righteous man. He prays at night when the people are asleep,” then his action becomes null and void, since he did not sincerely seek the Face of Allâh alone, but rather he sought the praises of people, thus becoming sinful by associating partners with Allâh in his action.
However, if his action only became null and void, then the following hadeth would apply to him; and he would not be punished for this action:
“How many fasting people obtain nothing from their fasting except hunger and thirst. And how many people who stay up at night (praying), obtain nothing from their being awake except sleeplessness and tiredness.” [Sahîh: Related by Ibn Mâjah (1/539) and Ahmad (2/441) from Ibn ‘Umar (radi-Allâhu ‘anhu).]
But this is not the case, for this person’s action has changed into a sin. The two rak’ât that this person performed without intending to seek only the Face of Allâh – the Exalted and Sublime – are the same as if he had disobeyed Him, that is to say: He will be punished for these two rak’ât because he associated others along with Allâh – the Exalted and Sublime – in his action.
If a man prays eleven rak’ât at night with the intention, in this worship, that his brothers would say about him: “This man is correctly following the Prophet; he does not add to the Sunnah,” his action becomes null and void; and his action changes to a sin against him. Rather, he must pray according to the Sunnah but sincerely seeking only the Face of Allâh – the Most High. He must be absolutely free of seeking the pleasure of others along with Him in this worship.