"The Messenger of Allah said: 'Actions are only done with intentions, and every man shall have what he intended. Thus he whose emigration was for Allah and His Messenger, his emigration was for Allah and His Messenger, and he whose emigration was to achieve some worldly benefit or to take some woman in marriage, his emigration was for that which he intended."
قَالَ رَسُولُ اللَّهِ ﷺ إِنَّمَا الأَعْمَالُ بِالنِّيَّةِ وَإِنَّمَا لاِمْرِئٍ مَا نَوَى فَمَنْ كَانَتْ هِجْرَتُهُ إِلَى اللَّهِ وَإِلَى رَسُولِهِ فَهِجْرَتُهُ إِلَى اللَّهِ وَإِلَى رَسُولِهِ وَمَنْ كَانَتْ هِجْرَتُهُ إِلَى دُنْيَا يُصِيبُهَا أَوِ امْرَأَةٍ يَنْكِحُهَا فَهِجْرَتُهُ إِلَى مَا هَاجَرَ إِلَيْهِ