Hazrat Umar bin Khattab (may Allah be pleased with him) narrated that the Prophet Muhammad (peace and blessings be upon him) said: Indeed, actions are judged by intentions, and every person will get what he intended. So, whoever migrates for Allah and His Messenger, then his migration is for Allah and His Messenger. And whoever migrates for worldly gain or to marry a woman, then his migration is for that for which he migrated.
Hadith Referenceاللؤلؤ والمرجان / كتاب الإمارة / 1245
Hadith Gradingمحدثین:«صحیح»
Hadith Takhrij«صحیح، أخرجه البخاري في: 83 كتاب الأيمان والنذور: 23 باب النية في الأيمان»
Brief Explanation
Imam Nawawi, in his commentary on Sahih Muslim, writes: The greatness of this hadith, its lofty status, its numerous benefits, and the consensus of all Muslims on its authenticity are established. Imam Shafi’i and other scholars state that it constitutes one third of Islam. And Imam Shafi’i says that it enters into seventy chapters of jurisprudence (i.e., rulings for seventy juristic issues are found within it). Abdur Rahman ibn Mahdi and others say that whoever wishes to author a book should begin with this hadith, so that the student and reader are alerted to the correction of intention. (Compiled)