Umar ibn al-Khattab (RA) → 'Alqamah ibn Waqqas al-Laythi → Muhammad ibn Ibrahim al-Taymi → Yahya ibn Sa'id al-Ansari → Sufyan ibn 'Uyaynah → Imam al-Bukhari
Actions are only by intentions, and every person will have only what they intended. Whoever migrated to Allah and His Messenger, then his migration is to Allah and His Messenger. And whoever migrated for the sake of worldly gain or to marry a woman, then his migration is to what he migrated for.
Explanation
This hadith opens Sahih al-Bukhari and is considered by many scholars to be one of the most comprehensive and foundational statements in all of Islamic teaching. The word niyyah (intention) refers to the resolve of the heart directed toward an act of worship or deed. The phrase 'innamal a'malu binniyyat' uses the particle 'innama' which in Arabic grammar restricts the meaning — it does not merely say that actions are with intentions, but rather that actions exist and have value only by virtue of intentions.
Without a correct and sincere intention, a deed may be physically performed but holds no spiritual weight before Allah. The second clause, 'wa innama likulli imri'in ma nawa,' further personalises this principle — each individual is accountable precisely and only for what they personally intended, not what others assumed of them or what might be assumed from outward appearances.
The Prophet ﷺ then illustrated this principle with the concrete example of hijrah (migration), which was the defining act of the early Muslim community. The example reveals the depth of the principle: two people may perform the exact same outward act — leaving Makkah for Madinah — but if one does so purely for Allah and His Messenger while another does so to gain wealth or to marry a particular woman, the rewards are entirely different.
The hijrah was chosen as the example precisely because it was the greatest act of sacrifice and worship the early Muslims knew. This hadith therefore establishes that Islam is not merely a religion of forms and rituals but a religion of the heart. Sincerity — ikhlas — is the soul of every act. The hadith also teaches the Islamic principle that lawful worldly motivations do not necessarily invalidate an act, but they do reduce or eliminate the spiritual reward that would otherwise accrue.
When and why it was said
This hadith was narrated in the context of the hijrah from Makkah to Madinah, the defining moment of early Islamic history. After years of persecution in Makkah, the Muslims were commanded to migrate to Madinah in the year 622 CE, an event so momentous that the Islamic calendar itself is dated from it. As reports reached the community, there were cases where men had migrated not purely for the sake of Allah but for worldly reasons — one well-known account mentions a man who migrated to Madinah to marry a woman known as Umm Qays, such that he was nicknamed 'Muhajir Umm Qays' (the one who migrated for Umm Qays).
This hadith, narrated by Umar ibn al-Khattab (RA), who heard it directly from the Prophet ﷺ, was a direct response to the spiritual danger of performing the greatest act of that era for lesser motives.
Imam al-Bukhari's decision to place this hadith as the very first hadith in his Sahih was a deliberate and profound editorial choice. Scholars have noted that al-Bukhari thereby signals to every reader and student: before you proceed any further in learning this religion, purify your intention for doing so. The placement serves as a gatekeeping principle — a reminder that knowledge itself is an act of worship and must be pursued with the correct intention. Al-Bukhari reportedly stated that he began his collection with this hadith because every scholarly undertaking, every act of learning, and every deed recorded therein must be evaluated through the lens of intention.
What the scholars said
Ibn Hajar al-Asqalani in his monumental commentary Fath al-Bari dedicates extensive discussion to this opening hadith, noting that scholars counted it among the pivotal foundations (qawa'id) of Islam. He cites the position of Imam al-Shafi'i, who famously declared that this single hadith constitutes one third of all religious knowledge, because human activity is either of the heart, the tongue, or the limbs — and this hadith governs the heart's role in all of them.
Ibn Hajar also discusses at length why Imam al-Bukhari chose Yahya ibn Sa'id al-Ansari as the sole conduit through whom this hadith was transmitted from Muhammad ibn Ibrahim al-Taymi, noting that this hadith was famously described as 'gharib' (singular in chain) because it passed through only one narrator at certain levels of its isnad, which makes al-Bukhari's decision to place it first all the more striking as an act of scholarly courage and deliberate instruction.
The great Hanbali scholar Ibn Rajab al-Hanbali wrote an entire treatise on this hadith titled Jami' al-'Ulum wal-Hikam, in which he analyses the two-part structure of the hadith and explains the difference between the first clause (which speaks to the validity of acts) and the second clause (which speaks to the reward of acts). He argues that the first clause addresses whether an act counts at all in the sight of Allah — an act of worship done without any intention of worship, such as washing one's face as mere hygiene rather than wudu, does not count as wudu.
The second clause then teaches that among those acts which do count, the degree of reward is proportional to the quality and sincerity of one's intention.
Putting it into practice
A Muslim seeking to implement this hadith today should begin with the practice of conscious intention-setting before every act of worship. Before each of the five daily prayers, take a moment — even just a few seconds — to mentally affirm to yourself and before Allah why you are performing this prayer: not out of habit, not out of social obligation, not to be seen, but purely as an act of submission to your Creator.
This practice of verbal or mental niyyah is well-established in Islamic jurisprudence, and even for those acts where a verbal niyyah is not strictly required by the fuqaha (jurists), the conscious mental act of intending for Allah's sake transforms the quality of worship from mechanical performance to a living conversation with Allah. Over time, practising this before every salah, every fast, every act of charity, and every instance of seeking knowledge will train the heart to seek sincerity as its default orientation.
Beyond acts of worship, this hadith also has profound implications for everyday life. A Muslim who understands this teaching can transform mundane activities into acts of worship by aligning their intention. Working to provide for one's family with the intention of fulfilling a religious obligation, eating healthily with the intention of maintaining the body as an amanah (trust) from Allah, or even sleeping with the intention of resting in order to have energy for worship — all of these become acts of worship when performed with the correct intention.
Practically, one can adopt the habit of a brief mental 'intention check' each morning: ask yourself, for what am I going to do today, and why? Renewing your intention to please Allah and benefit your community before leaving the house each day is a simple but transformative habit that this foundational hadith directly calls us to.
The Prophet's character ﷺ
This hadith reveals the Prophet ﷺ's extraordinary ability to distil the most complex theological reality into a single, short, unforgettable sentence. The Prophet ﷺ was not primarily a philosopher who constructed elaborate arguments, nor a legalist who catalogued rules. He was a teacher of the human soul, and in this hadith he demonstrates his gift for reaching the very root of the matter: the inner life determines the worth of the outer life.
His choice of the hijrah — the most emotionally charged act of his community's experience — as the illustrative example shows his deep pastoral intelligence. He knew that abstract principles must be grounded in lived reality to change hearts, and by using an example every single one of his companions had personally experienced, he made the principle unforgettable.
Companion spotlight
Umar ibn al-Khattab (RA) was the second Caliph of Islam and one of the most towering figures of the early Muslim community. Known as al-Faruq — the one who distinguishes between truth and falsehood — Umar was a man of extraordinary personal strength, justice, and spiritual sincerity. He embraced Islam after initially being one of its fiercest opponents, and his conversion was so impactful that the Muslims, who had been praying in secret, for the first time dared to pray openly in the Haram.
His direct, uncompromising personality made him an ideal narrator for a hadith about the inner authenticity of deeds, for Umar was a man who despised spiritual pretension and demanded that one's outward conduct match the state of one's heart. The fact that he alone narrated this particular hadith in the early generations lends it both an air of exclusivity and a particular authority — Umar's witness to a teaching about sincerity carries special weight precisely because his own character was defined by that quality.
Through a companion's eyes
Today the Messenger of Allah ﷺ spoke words that I feel will outlast all of us. We were gathered — I do not recall now whether it was after Fajr or in the evening — and he said: 'Innamal a'malu binniyyat.' Actions are only by intentions. I felt those words land in my chest like a stone dropped into still water, rippling outward. I thought immediately of the man they call Muhajir Umm Qays, who left Makkah and walked the same road we all walked, endured the same heat and the same fear, and yet his migration counted for nothing in the scale of Allah because his heart was elsewhere.
What a terrifying truth. I left that gathering resolved to examine every prayer, every fast, every act — to hold it up to the light of intention and ask: am I doing this for Allah, or am I doing this to be seen, to be praised, to gain something in this world? Allah, make my intentions pure. The road to You is the same road for all of us. Only the heart makes the difference. (Creative narrative based on authentic hadith)
Wisdom we see today
Modern psychology offers striking support for the core insight of this hadith. Research in motivational psychology, particularly studies on intrinsic versus extrinsic motivation conducted by Edward Deci and Richard Ryan in their Self-Determination Theory (SDT), consistently shows that actions performed for intrinsic reasons — that is, reasons that come from within the self, for inherent value rather than external reward — produce significantly greater well-being, persistence, and moral consistency than actions performed for external validation or material gain.
A Muslim who prays, fasts, or gives charity purely to please Allah (the ultimate intrinsic motivation) is, from a psychological standpoint, engaging in the most psychologically healthy form of motivation. Furthermore, research on cognitive consistency shows that when a person's stated values and actual motivations are aligned — as this hadith demands — they experience lower levels of cognitive dissonance, greater psychological integrity, and higher life satisfaction.
Differences of opinion
Classical scholars debated what exactly the first clause of this hadith negates. The Hanafi position, articulated by scholars such as Ibn al-Humam, holds that a physical act of worship performed without a conscious intention is not valid at all — the intention is a condition (shart) of the act's correctness. The Maliki school, as understood by Ibn Rushd al-Qurtubi, distinguishes between acts where the intention must accompany the act from the very beginning (such as salah) and acts where the intention at the outset is sufficient even if one becomes heedless later (such as fasting).
Imam al-Shafi'i and Imam Ahmad hold similar positions to the Hanafis on the necessity of intention but differ on the permissibility of verbal niyyah said before the act begins. These differences have practical consequences in fiqh — for example, whether wudu performed purely out of cooling oneself in hot weather counts as valid purification for salah.
What would you do?
You have been volunteering every Friday at a local Islamic centre, distributing food to the needy, and you have received public recognition and warm praise from the community. One day, as you are about to leave the house for your weekly volunteer shift, you pause and honestly examine your heart — and you realise that a significant part of your motivation is the appreciation and social standing you receive, rather than purely seeking the pleasure of Allah.
You still want to help, and the people genuinely need the service. Reflecting on this hadith, what specific steps would you take to purify your intention before going, and how would you restructure your approach to this ongoing act of charity so that its foundation becomes more securely rooted in sincerity?
Sahih: authentic, with a sound chain of narrators.