Imam Nawawi states:
عن أمير المؤمنين أبي حفصٍ عمر بن الخطاب رضي الله عنه قال : سمعت رسول الله عليه وسلم يقول : سمعت رسول الله صلى الله عليه وسلم قال : ( إنما الأعمال بالنيات ، وإنما لكل امرئ ما نوى ، فمن كانت هجرته إلى الله ورسوله فهجرته إلى الله ورسوله ، ومن كانت هجرته لدنيا يصيبها أو امرأة ينكحها فهجرته إلى ما هاجر إليه ) .
رواه إماما المحدثين أبو عبد الله محمد بن إسماعيل بن إبراهيم بن المغيرة بن بردزبه البخاري وأبو الحسين مسلم بن الحجاج بن مسلم القشيري النيسابوري في صحيحيهما اللذين هما من أصح الكتب المصنفة .
From the Commander of the Faithful Abi Hafs ‘Umar Ibn Al Khattab, who said : I heard the Prophet of Allah (Allah bless him and grant him peace) say :
“Actions are but by intentions and every man shall have but that which he intended. Thus he whose migration was for Allah and His messenger, his migration was for Allah and His messenger, and he whose migration was to achieve some worldly benefit or to take some woman in marriage, his migration was for that for which he migrated.”
The two imams of hadith: Abu `Abdullah Muhammad ibn Isma`il ibn Ibrahim ibn al Mughira ibn Bardizbah al Bukhari and Abu Al Husayn Muslim ibn al Hajjaj ibn Muslim al Qushayri al Naysaburi narrated it in their two collections of sound hadith which are the soundest of all hadith compilations.
The Importance of this Hadith
Imam Nawawi stated in his Sharh of Sahih Muslim:
قوله صلى الله عليه وسلم : ” ( إنما الأعمال بالنية ) الحديث . أجمع المسلمون على عظم موقع هذا الحديث
“The Prophets saying, ‘Actions are by Intentions’. There is agreement amongst the Muslims on the greatness of this Hadith.”
The above hadith is considered one the “Pivots-of-Islam Hadith” (al hadith al lati `alayha madar al islam) as stated by Imam Nawawi in his Bustan Al `Arifin. This is because it relates to ones outward actions and makes clear that the acceptance of these outward actions are intrinsically related to ones intentions.
Both Imam Shafi`i and Imam Ahmad ibn Hanbal stated that this hadith conveyed a third of the knowledge of the religion. This is mainly because the religion is a combination (majmu’a) of three things, as Imam Badr Al Din `Ayni stated in his Umdat Al Qari, which are:
قول و فعل و نية
“Sayings, Actions and Intention.”
This can be interpreted, thus, as:
 The tongue
 The various body parts such as hands, feet and so forth.
 The heart
Since the intention is connected to the heart this hadith was given the title of “A third of Islam” as Ibn Daqiq al `Id and Imam Nawawi stated in their respected commentaries:
قال الشافعي وآخرون : هو ثلث الإسلام
Imam Bayhaqi further stated, as narrated in the Mirqat, that the intention is actually the “first of the three”, meaning, that it takes precedence over sayings and actions due to the reason outlined previously i.e. all outward actions are only accepted based on intentions. This precedence is also supported in the hadith narrated by Ibn Hajar Haythami in his Majma’ al Zawa’id (Bab niyyat al mu’min wa ‘amal al munafiq) from Sahl ibn Sa`d:
نية المؤمن خير من عمله
“The intention of a believe is better then his action.”
The Meaning of the Phrase “Actions are by Intentions”
Before proceeding one should know the difference between `amal and fi`l, which although is sublte still exists.
Shaykh Al Hadith Salimullah Khan states in his commentary on Mishkat al Masabih that the difference between `amal and fi`l is that an `amal is done after thinking and contemplating. Therefore, we have the saying:
العمل ما كان عن فكر و روية
However, a fi`l is general (aam) and refers to acts done knowingly or unknowingly, thus the saying:
والفعل عام لما كان بعلم أو بغير علم
Secondly, `amal points to perseverance and continuance due to the fact that there is contemplation and thought behind it. This is not the case with fi`l as Allah Most high states in the Qur’an (Surah Feel):
أَلَمْ تَرَ كَيْفَ فَعَلَ رَبُّكَ بِأَصْحَـٰبِ ٱلْفِيلِ
And the destruction of the “People of the Elephant” occurred over a small, effortless period.
Benefit: Thus, we see that when pointing to good actions, which remain consistent and continuance, the Prophet (Allah bless and grant him peace) used the word “a`maal” and not “af`aal“. This is the same reason why the Qur’an uses the word `amal at various places to describe rightous deeds. Therefore, one will never see the Qur’an stating, “wa af`alu salihan“.
Thirdly, “sayings” (qawl) are also included within `amal but they are not related to a fi`l. So, ‘amal relates to that which is within the capacity of human ability (“qawl” is), but since fi`l is general it relates to all things – whether humans are able to do them or not. Since man is only responsible for that which is within his ability, this provides another reason why the Qur’an states “`amalu salihan” and not “af’alu salihan” and why the Prophet used the word `amal.
With this in mind one can proceed to define what the phrase Actions signifies in this hadith. Imam Nawawi states:
“By saying “Actions are by Intentions,” the Prophet (Allah bless him and grant him peace) meant acts of obedience at the exclusion of permitted actions that are neither recommended nor disliked.”
This is because a permitted action that does not serve any need does not imply or draw one closer to Allah. Similarly, a disliked action will remain disliked regardless of the intentions. Al Harith al Muhasibi stated:
“There is no sincerity in a forbidden action nor in a disliked one, as in the case of someone who looks at something which is forbidden for him to look at, claiming that he only looks in order to reflect upon God’s handiwork.”
However, a permitted action may become an act of obedience with the right intention. Shaykh `Abd Al Ghani Nabulisi states:
المباح بالنّيةِ طاعةَ
“The permissible with (sincere) intention becomes obedience (to Allah)”
Defining “actions” Imam Nawawi further states:
“By his word “actions” it is possible that the Prophet meant the soundness of actions, or the correctness of actions, or the acceptance of actions by God, or the perfection of actions. The latter is the sense adopted by Imam Abu Hanifa.
Whatever is by way of eliminating something is not counted as one such action. For example: to remove filth from oneself, to resist force, to reject faults, to convey gifts, and other than that. The soundness of these actions is not dependent upon correcting one’s intention; however, their reward is dependent upon the intention of drawing near to God.”
(Translated by Sidi Gibril Haddad)
Linguistically, intention relates to any type of directing, aim, or objective. This is what Qadhi Baydhawi stated.
In its shari`ah usage, it relates to specifying ones directing and aim to an action in order to attain Allahs pleasure and proceeding to fulfill that act. If he intends to do it and then delays, it is considered a “decision” (‘azm).
The intention can be divided into three types:
 In order to distinguish an act of habit from an act of worship. An example of this would be one sitting in a mosque to rest compared to one sitting therein with the intention of i`tikaf (seclusion/retreat).
 In order to distinguish an act of worship from another act of worship. An example of this is praying four rakahs during Dhuhr time. The intentions helps distinguish whether one is praying fardh or the sunnah.
 In order to distinguish an object of worship from another object of worship. This is the definition in the usage of the Qur’an, that ones worship be solely for Allah without any partners. This is also the meaning intended by the Sufis in their discussion of sincerity (ikhlas).
As for riya’ (showing-off), it is the opposite of sincerity, and it is of two kinds:
 Seeking none other then the people’s pleasure. This is why al Samarqandi said:
“All that one does for the sake of God the Exalted is accepted, and all one does for the sake of people is rejected.”
 Seeking both the people and the Lord of the people. This is why Shaykh `Izz ibn `Abd al Salam said:
“If he performed the obligatory prayer both for the sake of Allah the Exalted and for the sake of the people, then his prayer is definitely not accepted because he has ascribed a partner to God at the root of his action.”
Both of these amount to nothing in the eyes of Allah.
Showing-off can also be through leaving an action for people such as in the case of someone resolving to do an act of worship and leaving it out of fear that people will see him. However, if he leaves and goes into seclusion and does the act – this recommended.
Similarly, advertising ones actions is also a form of showing-off. The Prophet (Allah bless him and grant him peace) said (agreed upon hadith):
قال رسول الله صلى الله عليه وسلم من سمع سمع الله به ومن راءى راءى الله به
“Whoever advertises himself, God will advertise him, and whoever exhibits himself, God will exhibit him.”
This is why many of the righteous considered forming a sound and pure intention as extremely difficult. Imam Sufyan Thawri would say as stated by Ibn Rajab in his Sharh on Imam Nawawi’s Arba`in:
“Nothing is more difficult for me to treat than my intention (niyya) for indeed it turns on me!”
The Three States Characterizing Sincere Actions
 An action performed out of fear of God the Exalted. This is the worship of slaves (`abid).
 An action performed in the pursuit of the Garden of Paradise and the pursuit of reward. This is the worship of traders (tujjar).
 An action performed out of shame before God and in order to fulfill the duty of servanthood and give thanks while one sees oneself remiss despite doing all this, fearing in his heart because he does not know, even then, if his action is accepted or not: This is the worship of free men (ahrar).
We pray to Allah to allow us to have sincere intentions alongside our actions, rather the sincerest of all intentions.
Blessings on the Prophet, his family, and his companions.