Allah, the Exalted, says:
"And they were commanded not, but that they should worship Allah, and worship none but Him Alone (abstaining from ascribing partners to Him), and perform As-Salat (Iqamat-as-Salat) and give Zakat, and that is the right religion.'' (Q98:5)
"It is neither their meat nor their blood that reaches Allah, but it is piety from you that reaches Him.'' (22:37)
"Say (O Muhammad (PBUH) ): Whether you hide what is in your breasts or reveal it, Allah knows it". (3:29)
Narrated 'Umar bin Al-Khattab (May Allah be pleased with him), reported: Messenger of Allah (PBUH) said, "The deeds are considered by the intentions, and a person will get the reward according to his intention. So whoever emigrated for Allah and His Messenger, his emigration will be for Allah and His Messenger; and whoever emigrated for worldly benefits or for a woman to marry, his emigration would be for what he emigrated for".
[Al-Bukhari and Muslim].
Commentary: According to some Ahadith, the reason for this Hadith is that a person sent a proposal of marriage to a woman named Umm Qais, which she turned down saying that he should have to emigrate to Al-Madinah for it. Accordingly, he did it for this specific purpose, and the two were married there. On account of this event, the man came to be known among the Companions as Muhajir Umm Qais.
On the basis of this Hadith, 'Ulama' are of the unanimous opinion that the real basis of one's actions is Niyyah (intention) and everyone will be requited according to his Niyyah. It is true that Niyyah is founded in one's heart, that is to say, one has first to make up one's mind for what he intends to do and he should not express it verbally. In fact, the latter is a Bid`ah (innovation in religion) because no proof of it is found in Shariah.
The point which becomes evident from this Hadith is that Ikhlas (sincerity) is a must for every action. In other words, in every righteous deed, one should seek only the Pleasure of Allah; otherwise, it will not be accepted by Allah.