Sunan an-Nasa'i 3437
It was narrated that 'Umar bin Al-Khattab, may Allah be pleased with him, said that the Messenger of Allah said:
"Actions are but by intentions, and each man will have but that which he intended. Whoever emigrated for the sake of Allah and His Messenger, his emigration was for the sake of Allah and His Messenger, and whoever emigrated for the sake of some worldly gain or to marry some woman, his emigration was for that for which he emigrated."
أَخْبَرَنَا عَمْرُو بْنُ مَنْصُورٍ، قَالَ حَدَّثَنَا عَبْدُ اللَّهِ بْنُ مَسْلَمَةَ، قَالَ حَدَّثَنَا مَالِكٌ، وَالْحَارِثُ بْنُ مِسْكِينٍ، قِرَاءَةً عَلَيْهِ وَأَنَا أَسْمَعُ، عَنِ ابْنِ الْقَاسِمِ، قَالَ أَخْبَرَنِي مَالِكٌ، عَنْ يَحْيَى بْنِ سَعِيدٍ، عَنْ مُحَمَّدِ بْنِ إِبْرَاهِيمَ، عَنْ عَلْقَمَةَ بْنِ وَقَّاصٍ، عَنْ عُمَرَ بْنِ الْخَطَّابِ، رضى الله عنه - وَفِي حَدِيثِ الْحَارِثِ أَنَّهُ سَمِعَ عُمَرَ يَقُولُ - قَالَ رَسُولُ اللَّهِ صلى الله عليه وسلم ‏
"‏ إِنَّمَا الأَعْمَالُ بِالنِّيَّةِ وَإِنَّمَا لاِمْرِئٍ مَا نَوَى فَمَنْ كَانَتْ هِجْرَتُهُ إِلَى اللَّهِ وَرَسُولِهِ فَهِجْرَتُهُ إِلَى اللَّهِ وَرَسُولِهِ وَمَنْ كَانَتْ هِجْرَتُهُ لِدُنْيَا يُصِيبُهَا أَوِ امْرَأَةٍ يَتَزَوَّجُهَا فَهِجْرَتُهُ إِلَى مَا هَاجَرَ إِلَيْهِ ‏"‏ ‏.‏