The Statement of Allah: They ask you (O Muhammad ﷺ) about Al-Anfal (the spoils of war). Say: The spoils are for Allah and the Messenger ﷺ. So fear Allah and adjust all matters of difference among you... (V.8:1)

Hadith Number 4645

setting

Narrated Sa`id bin Jubair

I asked Ibn `Abbas regarding Surat-al-Anfal. He said, "It was revealed in connection with the Battle of Badr."