عَنْ عُمَرَ رَضِيَ اللَّهُ عَنْهُ قَالَ: سَمِعْتُ رَسُولَ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَآلِهِ وَسَلَّمَ يَقُولُ: ((إِنَّمَا الْأَعْمَالُ بِالنِّيَّةِ، وَلِكُلِّ امْرِئٍ مَا نَوَى فَمَنْ كَانَتْ هِجْرَتُهُ إِلَى اللَّهِ وَرَسُولِهِ فَهِجْرَتُهُ إِلَى مَا هَاجَرَ إِلَيْهِ، وَمَنْ كَانَتْ هِجْرَتُهُ لِدُنْيَا يُصِيبُهَا أَوِ امْرَأَةٍ يَنْكِحُهَا فَهِجْرَتُهُ إِلَى مَا هَاجَرَ إِلَيْهِ))
It is narrated from Sayyiduna Umar (may Allah be pleased with him) that the Messenger of Allah (peace and blessings be upon him) said: "Actions are judged only and only by intentions, and every person will have only that which 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 worldly gain, he will attain it, and whoever's migration is for a woman to marry her, he will marry her. In any case, his migration will be for that which he migrated towards."