I heard the Messenger of Allah ﷺ say, "Actions are judged only by intentions, and every person will have only what he intended. Whoever's migration was for the sake of Allah and His Messenger, his migration is to Allah and His Messenger. And whoever's migration was for some worldly gain he sought, or a woman he wished to marry, his migration is to whatever he migrated for."
سمعت رسول الله ﷺ يقول: إنما الأعمال بالنيات، وإنما لكل امرئ ما نوى؛ فمن كانت هجرته إلى الله ورسوله فهجرته إلى الله ورسوله، ومن كانت هجرته لدنيا يصيبها، أو امرأة يتزوجها فهجرته إلى ما هاجر إليه.
Bukhari (1) and Muslim (1907) both narrated it through the route of Yahya bin Saeed, from Muhammad bin Ibrahim, from Alqama bin Waqqas Laythi, who said, "I heard Umar bin Khattab," and he mentioned it. Ibn Khuzayma used it as the basis for a chapter heading in his Sahih (1/73), titled "The chapter on the obligation of forming the intention." Requiring the intention for wudu is the position of the majority of the scholars, among them Malik, Shafii, and Ahmad.