Sunan an-Nasa'i, Book 25, Hadith 54 (Nasa'i 3144)

It was narrated from Yahya bin Al-Walid bin 'Ubadah bin As-Samit that his grandfather said:

"The Messenger of Allah (ﷺ) said: 'Whoever fights in the cause of Allah intending only to get an 'Iqal, he will have what he intended."