Imam Raja bin Haywah (may Allah have mercy on him) and other Tabi'in said: "The khums should be taken out from the entire spoils of war, then after the khums, the nafl should be given, then the remaining wealth should be distributed among the army."
Hadith Referenceسنن سعید بن منصور / كتاب الجهاد / 3894