The Importance of Intention
The foundational hadith teaching that all actions are judged by their underlying intentions.
This hadith is considered the foundation of Islamic jurisprudence and spirituality. The Prophet (PBUH) said: 'Actions are but by intentions, and every person shall have only that which they intended.' This teaching means that the same outward action can be worship or sin depending on intention. A person who emigrates for Allah earns divine reward; one who emigrates for worldly gain earns only what they sought. Intention purifies actions and transforms ordinary activities into worship. Scholars place this hadith first in their collections due to its foundational importance.
Actions are but by intentions, and every person shall have only that which they intended.
Imam Shafi'i said this hadith constitutes one-third of all knowledge, and Ibn Hanbal said it comprises one-third of Islam.
Sahih Bukhari