It is narrated on the authority of Amir al-Mu’minin (Leader of the Believers), Abu Hafs ‘Umar bin al-Khattab (may Allah be pleased with him), who said: I heard the Messenger of Allah (peace be upon him), say
“Actions are according to intentions, and everyone will get what was intended. Whoever migrates with an intention for Allah and His messenger, the migration will be for the sake of Allah and his Messenger. And whoever migrates for worldly gain or to marry a woman, then his migration will be for the sake of whatever he migrated for.”
Related by Bukhari & Muslim
The Hadith narrated by Umar bin al-Khattab (may Allah be pleased with him) outline the central thought, culture and shows the regularity between the internal and external states for someone.
Similarly, it is a strong benefit hadith as it has been said that Islam revolves around the meaning of the Hadith.
The connection between the action and intention highlights the physical and spiritual components of any human.
The hadith emphasizes the importance of having an intention for every physical activity that we do and the importance of having a purpose for every action.
The believers should always be checking their intentions and understand the purpose of their actions. Also, they should be persistently asking themselves to verify their intentions for their short term and their long goals.
That said, Intentions lead to results. When a change in intention occurs, a change in the external conditions will follow. The intention is also enough for Allah (SWT) to make a change in our reality, so we should not belittle the necessary change in the intention that has to occur in order for our external condition to change.
In conclusion, Actions we do have to be for the sake of Allah (SWT). However, good action with bad intention will always lead to a bad results, which means one may not be rewarded or worse get punishment.