Hadith 142
Sayyiduna Umar bin Khattab (may Allah be pleased with him) narrates that I heard the Messenger of Allah (peace and blessings be upon him) say: "The acceptance of deeds depends upon the intention, and for every person is what he intended. (That is, reward or punishment will be according to good or bad intention.) So whoever's migration was for Allah and His Messenger (peace and blessings be upon him), then his migration is for Allah and His Messenger (peace and blessings be upon him). And whoever's migration was for worldly gain or to marry a woman, then his migration is towards that for which he migrated. In Ahmad's narration, these words are not present. « وانما لامري ما نوي » 'For a man is only that which he intended.'"
Hadith 143
Sayyiduna Umar bin Khattab (may Allah be pleased with him) narrates that I heard the Messenger of Allah (peace and blessings of Allah be upon him) say: "Actions are (judged) according to intentions. And for every person is what he intended."