(1) باب فِي تَرْكِ الْحِيَلِ وَأَنَّ لِكُلِّ امْرِئٍ مَا نَوَى فِي الأَيْمَانِ وَغَيْرِهَا
Narrated `Umar bin Al-Khattab:
The Prophet (ﷺ) said, 'O people! The reward of deeds depends upon the intentions, and every person will get the reward according to what he has intended. So, whoever emigrated for Allah and His Apostle, then his emigration was for Allah and His Apostle, and whoever emigrated to take worldly benefit or for a woman to marry, then his emigration was for what he emigrated for."
Reference: Sahih al-Bukhari 6953
In-book reference: Book 90, Hadith 1
USC-MSA web (English) reference(deprecated numbering scheme): Vol. 9, Book 86, Hadith 85