ʿUmar b. al-Khaṭṭāb (raḍiy Allāhu ʿanhu) reports that he heard the Messenger of Allāh (sall Allāhu ʿalayhi wa sallam) saying,
“All actions are only by their intentions and every person shall have only what he intended. Therefore, whoever’s migration was to Allāh and His Messenger, his migration was indeed to Allāh and His Messenger; and whoever’s migration was to attain some worldly lot or to marry a woman, his migration was to what he migrated to.”
ʿĀ’ishah (raḍiy Allāhu ʿanha) reports that the Messenger of Allāh (sall Allāhu ʿalayhi wa sallam) said,
“Whoever introduces into this affair of ours what is not part of it, it must be rejected,” another version has, “Whoever does an action that we have not enjoined, it must be rejected.”
These great aḥadīth encompass the whole religion: its foundations and its branches, its outer and its inner. The ḥadīth of ʿUmar mentions the benchmark by which to measure deeds inwardly and the ḥadīth of ʿĀ’ishah mentions the benchmark by which to measure deeds outwardly. They instruct us to have sincerity towards Allāh and to follow the Messenger: the prerequisites for the acceptance of every word and deed, the outer and inner. Therefore, it is the person who is sincere in deed and who follows the Messenger of Allāh whose action is accepted, whoever does not meet these two conditions, or even one of them, his action is rejected and is subsumed by His saying,
“We will advance the actions they have done and make them scattered specks of dust.”
The person who meets both pre-requisites falls under His saying,
“Who can have a better religion than someone who submits himself completely to Allāh and does good…” “Not so! All who submit themselves completely to Allāh and do good will find their reward with their Lord. They will feel no fear and will know no sorrow.” 
Intention (niyyah) refers to the motivation behind the act: to draw closer to Him and attain His good pleasure and reward. Therefore, two components must exist: an intention for the act itself and an intention for the one for whom the act is done.
With regards to the intention for the act itself, purification in all its various types, ṣalṣh, zakat, sawm, Ḥajj; indeed all acts of worship cannot be considered to be valid unless someone first desires to do that action and has the actual intention for it. Therefore, one must have the intention to perform that specific action of worship. If the act of worship is itself of different types such as ṣalṣh which is either obligatory, optional but specific, or optional but unrestricted: it is sufficient for the unrestricted that one just intend to pray, but as for the obligatory or the specific optional, one must have the intention for that specific prayer, such as the intention to pray witr or the ratibah.
It is also necessary to distinguish habit from worship: one can bathe, for example, either to clean oneself, or because of the greater impurity (al-hadath al-akbar), or because he has washed a dead body, or because it is the day of Jumuʿah; as such he must have the intention that he is bathing to remove the impurity or have the intention for the other recommended baths. In a similar fashion, a person could give money away as zakat, or for expiation (kaffarah), or because he made an oath (nadhr), or for sadaqah which is recommended, or as a gift: all of these must be accompanied with their specific intentions.
Included in this is trickery in transactions whereby a person undertakes a venture which outwardly seems legal but is, in reality, a form of interest, or to sidestep an obligation, or to do something prohibited. In this case it is his intention and objective that is taken into consideration and not what he is outwardly saying. This was stated by Shaykh al-Islām Ibn Taymiyyah. Similarly, Allāh has set the condition for accepting the wife back (al-rajʿah) and in wills (wasiyyah) that the intent not be to harm.
Included in this are all means that lead to their ends because the means take on the same rulings as the ends, the good and bad; and Allāh knows the one who intends good from the one who intends bad.
With regards the intention for the One for whom the action is done, it is to have sincerity to Allāh in everything that the servant brings and abandons, and in everything that he says and does. Allāh, Most High, says,
“They have been commanded only to worship Allāh, making the religion sincerely for him” “Indeed is the sincere religion not Allāh’s alone?”
It is upon the servant to have an all-encompassing intention in all his affairs: desiring Allāh’s face, working to draw closer to Him, seeking His reward, being expectant of it, and fearing His punishment. This intention must be present in all his deeds and statements and, alongside this, the servant must have the ardent desire to make this sincerity a living reality and try his utmost to perfect it. He must repress all that would diminish it such as ostentation and desire for position and praise. If it happens that a person does acquire status and praise, he must ensure that this remains secondary and that the essential objective remains Allāh’s face and seeking His reward without being distracted by the creation. Any worldly position or status that arises as a result of this would then be from the temporal rewards meted out to be believer.
His saying, “Of a surety all actions are but by their intentions,” means that the actions cannot come about except by intention and it is upon this that they revolve around. “And every person shall have only what he intended,” means that the intention of the servant will determine the merit, aberrance, perfection or shortcoming in the deed. Hence, whoever intends to do good and his objective is lofty – seeking to draw closer to Allāh – for him is a complete reward. As a person’s purity of intention and loftiness of objective decreases so too does the reward. It was to exemplify this that the Prophet (sall Allāhu ʿalayhi wa sallam) proceeded to give an example that could be used as a basis for analogy to all affairs, “The one whose migration was for Allāh and His Messenger, his migration was for Allāh and His Messenger,” meaning he attained what he intended and has received its reward. “And the one whose migration was to attain some worldly lot or marry a woman, his migration was for what he made migrated for,” marriage has been specifically mentioned after the generalisation to emphasise the fact that all of this is worthless and of no real benefit. This same fact is emphasised in the ḥadīth in which the Messenger of Allāh (sall Allāhu ʿalayhi wa sallam) was asked about the one who fought to show his courage, or fought for nationalism, or fought to show his status: who has fought in the way of Allāh? He (SAW) replied, “The one who fought so that Allāh’s word be made supreme is the one who fought in the Way of Allāh”.
Allāh (subḥānahu wa taʿālā) says concerning spending in charity,
“The metaphor of those who spend their wealth desiring the pleasure of Allāh and firmness for themselves is that of a garden on a hillside: when heavy rain falls on it, it doubles its produce; and if heavy rain does not fall on it, there is dew.”
“…We have prepared a humiliating punishment for the disbelievers, and also for those who spend their wealth to show off to people, not having faith in Allāh and the Last Day.”
The same applies to all deeds.
Deeds vary in degree and reward in accordance to the strength of faith and sincerity present in the heart. This is true to the point that anyone who has a truthful intention and does all that he can do enact the deed, he will get the reward of the deed [even if it turns out that he cannot perform it]. Allāh (subḥānahu wa taʿālā) says,
“If anyone leaves his home, migrating to Allāh and His Messenger, and death catches up with him, it is Allāh who will reward him.”
The Saḥīḥ records that the Prophet (sall Allāhu ʿalayhi wa sallam) said, “When the servant falls ill, or embarks on a journey, the deeds he performed while healthy or resident are recorded for him. He (sall Allāhu ʿalayhi wa sallam) also said, “In Madīnah are some people, you have not travelled any distance, or traversed any valley, except that they were with you, they were detained due to a valid excuse,” meaning their hearts were with you and they shared your reward. When the servant desires to do good but is unable to do it, his desire and intention are written as one complete reward. Being good to the creation through wealth, deed and speech is an example of goodness and the reward for this lies with Allāh; however, the amount of reward is dependent upon the intention. Allāh (subḥānahu wa taʿālā) says,
“There is no good in much of their secret talk, except in the case of those who enjoin towards charity, or what is right, or putting things right between people. If anyone does that, seeking the pleasure of Allāh, We will give him an immense reward.”
Bukhārī records the ḥadīth in which the Prophet (sall Allāhu ʿalayhi wa sallam) said, “Whoever takes the wealth of people intending to pay it back, Allāh will repay it on his behalf; and whoever takes the wealth of people intending to squander it, Allāh will waste him.” Carefully consider how Allāh has made righteous intention a means to provision and Allāh’s repaying on his behalf, and an evil intention a means to waste and destruction.
Intention also has an important bearing on permissible and worldly matters. Whoever intends for his earnings, his worldly deeds and habits to aid him in establishing the rights of Allāh, in doing the obligations and recommendations, and he has this intention when eating, drinking, sleeping, resting and working: his habits are turned into acts of worship. Allāh will bless him in his work and open for him such doors to goodness and provision that he could never have previously imagined. Whoever misses out on having this righteous intention, either due to ignorance or negligence, then let him blame no one but himself.
The Prophet (sall Allāhu ʿalayhi wa sallam) said,
“You will not perform a single deed, desiring thereby Allāh’s face, except that you will be rewarded for it, even what you place in your wife’s mouth.”
Hence we learn that this ḥadīth covers all good. As such the believer who wishes to be successful must understand this ḥadīth and make it his goal to act by it in all his affairs and at every time.
As for the ḥadīth of ʿĀ’ishah (raḍiy Allāhu ʿanha), “Whoever introduces into this affair of ours that which is not part of it, it must be rejected,” another version has, “Whoever does an action that we have not enjoined, it must be rejected,” this has an understanding derived from its explicit wording (mantuq) and an understanding derived from its context (mafhum).
Its explicit wording proves that every innovation introduced in the religion that has no basis for it in the Book or Sunnah is completely rejected. This is regardless of whether this innovation is in speech and thought such as the philosophical based innovations of the Jahmiyyah, Rafidah and the Muʿtazilah; or whether it be by doing new deeds not legislated by Allāh and His Messenger. The people who do these innovations are blameworthy and the degree of blame varies in accordance to the severity of the innovation. Whoever informs us of something that Allāh and His Messenger have not informed us of, or worships Him in way not legislated by Allāh and His Messenger is an innovator.
As for the context, it proves that whoever does a deed that has been legislated by Allāh and His Messenger – to worship Him with correct beliefs and righteous deeds – his deeds are accepted and his efforts are rewarded.
This ḥadīth also proves that any act of worship that is performed in a fashion that has been prohibited is invalid. This is because it has not been legislated by the Sharīʿah and the prohibition of something necessitates its invalidity; therefore every transaction that has been prohibited by the Sharīʿah is useless and carries no weight.
Notes: Bahjat Qulubi l-Abrar wa Qurratu `Uyuni’l-Akhyar fi Sharh Jawami` al-Akhbar by `Abdu’l-Rahman ibn Nasir al-Sa`di. Translation by Abu Rumaysah.
Islam21c requests all the readers of this article, and others, to share it on your facebook, twitter, and other platforms to further spread our efforts.
 Bukhārī #2697 and Muslim #1718 Agreed upon. Al-Qur’ān, 25:23  Al-Qur’ān, 4:125  Al-Qur’ān, 2:112  Al-Qur’ān, 98:5  Al-Qur’ān, 39:3
 Bukhārī #2810 and Muslim #1904 on the authority of Abū Mūsā al-Ashʿari Al-Qur’ān, 2:265  Al-Qur’ān, 4:38  Al-Qur’ān, 4:100  Bukhārī #2996 on the authority of Abū Mūsā al-Ashʿari  Bukhārī #2839 on the authority of Anas and a similar wording is found in Muslim #1911 on the authority of Jabir.  Al-Qur’ān, 4:114  Bukhārī #2387 on the authority of Abū Hurayrah  Bukhārī #1295 and Muslim #1628 on the authority of Saʿd b. Abī Waqqās.