The Amir al-Mu'minin, Abu Hafs 'Umar ibn al-Khattab said, "I heard the Messenger of Allah, may Allah bless him and grant him peace, say, "Actions only go by intentions. Everyone gets what they intend. Anyone, therefore, who emigrates to Allah and His Messenger, his emigration is indeed to Allah and His Messenger. But anyone who emigrates to gain something of this world or to marry a woman, his emigration is to that to which he emigrated."
Riyadh-as-Saliheen by Imam Al-Nawawi, volume 1, hadith number 1 - Sunni Hadith