It was narrated from 'Umar bin Al-Khattab that the Prophet said:
"Actions are but by intentions, and each person will have but that which he intended. Thus, he whose emigration was for the sake of Allah and His Messenger, his emigration was for the sake of Allah and His Messenger, and he whose emigration was to achieve some worldly gain or to take some woman in marriage, his emigration was for that for which he emigrated."
Reference: Sunan an-Nasa'i 3794 In-book : Book 35, Hadith 34 English translation : Vol. 4, Book 35, Hadith 3825
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.