Musnad Ahmad 168
Grading supplied with this record: Sahih (Darussalam) [ al-Bukhari (1) and Muslim (1907)]
Narration text is preserved in its supplied Arabic and English. Translated interfaces and reading guides do not add narration translations in other languages.
حَدَّثَنَا سُفْيَانُ عَنْ يَحْيَى عَنْ مُحَمَّدِ بْنِ إِبْرَاهِيمَ التَّيْمِيِّ عَنْ عَلْقَمَةَ بْنِ وَقَّاصٍ قَالَ سَمِعْتُ عُمَرَ رَضِيَ اللَّهُ عَنْهُ يَقُولُ سَمِعْتُ رَسُولَ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ يَقُولُ إِنَّمَا الْأَعْمَالُ بِالنِّيَّةِ وَلِكُلِّ امْرِئٍ مَا نَوَى فَمَنْ كَانَتْ هِجْرَتُهُ إِلَى اللَّهِ عَزَّ وَجَلَّ فَهِجْرَتُهُ إِلَى مَا هَاجَرَ إِلَيْهِ وَمَنْ كَانَتْ هِجْرَتُهُ لِدُنْيَا يُصِيبُهَا أَوْ امْرَأَةٍ يَنْكِحُهَا فَهِجْرَتُهُ إِلَى مَا هَاجَرَ إِلَيْهِ.
Umar said: I heard the Messenger of Allah ﷺ say:
"Deeds are but by intentions and each man will have but that which he intended. If a man's migration was for the sake of Allah, then his migration was for that for which he migrated, but if his migration was to achieve some worldly aim or to take some woman in marriage, his migration was for that for which he migrated."
Full reference and source
Musnad Ahmad 168 Arabic/English book : Book 2, Hadith 168
View source on Sunnah.com (opens in a new tab)