Sayyiduna Umar bin Khattab (may Allah be pleased with him) narrates: The Noble Prophet (peace and blessings of Allah be upon him) said: "Actions are judged by intentions, and every person will get only what he intended. So whoever's migration was for Allah and His Messenger, his migration will be counted for Allah and His Messenger. And whoever's migration was for worldly gain or to marry a woman, then his migration will be counted towards that for which he migrated."