عُمَرَ بْنَ الْخَطَّابِ عَلَى الْمِنْبَرِ قَالَ: سَمِعْتُ رَسُولَ اللّٰه صلّى اللّٰه عليه وسلّم يَقُولُ: إِنَّمَا الْأَعْمَالُ بِالنِّيَّاتِ، وَإِنَّمَا لِكُلِّ امْرِئٍ مَا نَوَى، فَمَنْ كَانَتْ هِجْرَتُهُ إِلَى دُنْيَا يُصِيبُهَا، أَوْ إِلَى امْرَأَةٍ ينكحها، فهجرته إلى ما هاجر إليه
It was narrated by Hazrat Umar ibn al-Khattab, while he stood upon the pulpit, “I heard Allah’s Messengersa proclaim, ‘Indeed, actions are judged by intentions, and every individual will receive [their reward] according to what they intended. Therefore, one whose migration was for worldly gain or to marry a woman, their migration will be accounted for as to that which they intended.’”
(Sahih al-Bukhari, Kitab bad’i l-wahy, Hadith 1)