مُسْنَدِ عُمَرَ بْنِ الْخَطَّابِ رَضِيَ اللَّهُ عَنْهُ
2  
Musnad `Umar b. al-Khattab (ra)
Musnad Ahmad 168
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.`
حَدَّثَنَا سُفْيَانُ، عَنْ يَحْيَى، عَنْ مُحَمَّدِ بْنِ إِبْرَاهِيمَ التَّيْمِيِّ، عَنْ عَلْقَمَةَ بْنِ وَقَّاصٍ، قَالَ سَمِعْتُ عُمَرَ، رَضِيَ اللَّهُ عَنْهُ يَقُولُ سَمِعْتُ رَسُولَ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ يَقُولُ إِنَّمَا الْأَعْمَالُ بِالنِّيَّةِ وَلِكُلِّ امْرِئٍ مَا نَوَى فَمَنْ كَانَتْ هِجْرَتُهُ إِلَى اللَّهِ عَزَّ وَجَلَّ فَهِجْرَتُهُ إِلَى مَا هَاجَرَ إِلَيْهِ وَمَنْ كَانَتْ هِجْرَتُهُ لِدُنْيَا يُصِيبُهَا أَوْ امْرَأَةٍ يَنْكِحُهَا فَهِجْرَتُهُ إِلَى مَا هَاجَرَ إِلَيْهِ‏.‏
Grade: Sahih (Darussalam) [ al-Bukhari (1) and Muslim (1907)] (Darussalam)
Reference : Musnad Ahmad 168
In-book reference : Book 2, Hadith 85