Narrated Mus'ab bin Sa'd:
from his father who said: "On the Day of Badr I brought a sword so I said: 'O Messenger of Allah! Indeed Allah has satisfied my breast (i.e. my desire) on the idolaters - or something like that - give me this sword.' So he said: 'This is not for me, nor is it for you.' I said: 'Perhaps he will give this to someone who did not go through some struggle I went through (fighting).' So the Messenger of Allah (ﷺ) came to me [and he said:] 'You asked me, but it was not up to me. But now it has occurred that it is up to me, so it is yours.'" He said: "So (the following) was revealed: They ask you about the spoils of war (8:1)."
English reference: Vol. 5, Book 44, Hadith 3079
Arabic reference: Book 47, Hadith 3359