Sayyiduna Abu Hurayrah (may Allah be pleased with him) narrated that the Messenger of Allah (peace and blessings be upon him) said: "Spoils of war were not lawful for any black-headed people before you. The spoils would be gathered, and a fire would descend from the sky and consume them. When the battle of Badr took place, people hastened to the spoils, so Allah Almighty revealed: 'Were it not for a decree from Allah that had preceded, a great punishment would have touched you for what you took. So eat of what you have taken as spoils, lawful and good' [Surah al-Anfal: 68-69]."
Hadith Referenceالسنن الكبرى للبيهقي / كتاب قسم الفيء والغنيمة / 12708