Sahih al-Bukhari 1
Sahih Book of Revelation · Hadith 1 of 7,563I heard Allah's Messenger (ﷺ) saying, "The reward of deeds depends upon the intentions and every person will get the reward according to what he has intended. So whoever emigrated for worldly benefits or for a woman to marry, his emigration was for what he emigrated for
Chain of narrators6 narrators
Imam al-Bukhari opens his Sahih with this hadith as a reminder to himself and to every reader: the worth of a deed – including reading this book – is weighed by the intention behind it. Imam Ahmad counted it among the hadith on which the religion turns (reported by Ibn Rajab in Jami‘ al-‘Ulum wal-Hikam).
The emigration mentioned here is the hijrah from Makkah to Madinah. Two people may make the same journey, yet one is rewarded for emigrating for Allah and His Messenger, while the other gains only the worldly aim he set out for. The deed looks the same from outside; the difference is within.
The practical lesson is to renew the intention before prayer, study, work and charity, and to ask quietly before any action: for whom am I doing this?