Chapter: Explanation of how the spoils of war were spent at the beginning of Islam, and that they belonged to the Messenger of Allah (peace and blessings be upon him), who would give them to whomever he saw fit among those who took part in the battle and those who did not, until the saying of Allah, the Mighty and Majestic, was revealed: "And know that whatever you take as spoils of war, one fifth of it is for Allah, for the Messenger, for (the Messenger's) relatives, the orphans, the needy and the wayfarer" [Surah al-Anfal: 41].
So the khums (one fifth) went to those entitled to the khums, and its (remaining) four parts to those who took part in the battle.
Sayyiduna Sa'd (may Allah be pleased with him) said: Four verses were revealed concerning me. I obtained a sword on the day of Badr, and I said: O Messenger of Allah, give it to me. He (peace and blessings be upon him) said: "Put it back where you picked it up from." I said again: O Messenger of Allah, give it to me. He (peace and blessings be upon him) said: "Put it back where you picked it up from." I said again: O Messenger of Allah, give it to me; shall I remain like one who is destitute? The Messenger of Allah (peace and blessings be upon him) said: "Put it back where you took it from." Then this verse was revealed: "They ask you about the spoils of war. Say: The spoils of war belong to Allah and the Messenger" [Surah al-Anfal: 1].
Hadith Referenceالسنن الكبرى للبيهقي / كتاب قسم الفيء والغنيمة / 12710