عَنْ عُمَرَ بْنِ الْخَطَّابِ رَضِيَ اللَّهُ عَنْهُ قَالَ سَمِعْتُ رَسُولَ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَآلِهِ وَسَلَّمَ يَقُولُ إِنَّمَا الْأَعْمَالُ بِالنِّيَّةِ وَلِكُلِّ امْرِئٍ مَا نَوَى فَمَنْ كَانَتْ هِجْرَتُهُ إِلَى اللَّهِ عَزَّ وَجَلَّ فَهِجْرَتُهُ إِلَى مَا هَاجَرَ إِلَيْهِ وَمَنْ كَانَتْ هِجْرَتُهُ لِدُنْيَا يُصِيبُهَا أَوِ امْرَأَةٍ يَنْكِحُهَا فَهِجْرَتُهُ إِلَى مَا هَاجَرَ إِلَيْهِ
Narrated from Sayyiduna Umar bin Khattab (may Allah be pleased with him), he says: I heard the Messenger of Allah (peace and blessings be upon him) say: Actions are only by intentions, and every person will have only what he intended. So whoever's migration is for Allah and His Messenger, then his migration is for Allah and His Messenger. And whoever's migration is for the world, which he will attain, or for a woman whom he will marry, then his migration is for that for which he migrated. (In short), the migration of the emigrant is for that for which (with the intention of which) he migrated.