“I heard the Messenger of Allah ﷺ say: ‘Actions are but by the intention and every man will have but that which he intended. So he whose emigration was for Allah and His Messenger, his emigration was for Allah and His Messenger. But he whose emigration was for some worldly benefit or to take some woman in marriage, his emigration was for that which he migrated.”
سَمِعْتُ رَسُولَ اللَّهِ ﷺ يَقُولُ إِنَّمَا الأَعْمَالُ بِالنِّيَّاتِ وَلِكُلِّ امْرِئٍ مَا نَوَى فَمَنْ كَانَتْ هِجْرَتُهُ إِلَى اللَّهِ وَإِلَى رَسُولِهِ فَهِجْرَتُهُ إِلَى اللَّهِ وَإِلَى رَسُولِهِ وَمَنْ كَانَتْ هِجْرَتُهُ لِدُنْيَا يُصِيبُهَا أَوِ امْرَأَةٍ يَتَزَوَّجُهَا فَهِجْرَتُهُ إِلَى مَا هَاجَرَ إِلَيْهِ