It has been narrated on the authority of Umar b. al-Khattab that the Messenger of Allah (ﷺ) said:
(The value of) an action depends on the intention behind it. A man will be rewarded only for what he intended. The emigration of one who emigrates for the sake of Allah and His Messenger (ﷺ) is for the sake of Allah and His Messenger (ﷺ) ; and the emigration of one who emigrates for gaining a worldly advantage or for marrying a woman is for what he has emigrated.
Reference: Sahih Muslim 1907 a In-book : Book 33, Hadith 222 USC-MSA web (English) : Book 20, Hadith 4692 (deprecated)
Help us gift a modern, ad-free Islamic application for the Muslim Ummah. Your donation will be recorded as Sadaqah Jariyah in your book of deeds, In Sha Allah.