Importance of niyyah نیّة intention.
Ustadh Muhammad Tim Humble explains Imam Nawawi's hadith
“Actions are only judged according to intentions and every person will have what they intended."
Thus, he whose migration was for Allaah and His Messenger (sall Allahu alayhi wasallam, (then) his migration was for Allaah and His Messenger; and he whose migration was to achieve some worldly benefit or to take a woman in marriage, his migration was for that for which he migrated.”
[Talk took place at Jamia Masjid Ahl-e-Hadith UK]
Original video: DigitalMimbar
https://www.youtube.com/watch?v=650Adlk1cIc