The Messenger of Allah (ﷺ) said, 'Actions are solely by intentions, and for everyone is that which they intended. Thus he whose migration was to God and His Messenger, his migration was to God and His Messenger, and he whose migration was for worldly gain or intending a woman’s hand, then his migration was for that which he migrated to.'