Hazrat Saeed bin Musayyib said: People used to give voluntary charity from the khums. Imam Malik, may Allah have mercy on him, said: Of what I have heard in this regard, this is the most preferable to me.
قَالَ مَالِك : وَذَلِكَ أَحْسَنُ مَا سَمِعْتُ إِلَيَّ فِي ذَلِكَ . وَسُئِلَ مَالِك، عَنِ النَّفَلِ، هَلْ يَكُونُ فِي أَوَّلِ مَغْنَمٍ ؟ قَالَ : ذَلِكَ عَلَى وَجْهِ الْاجْتِهَادِ مِنَ الْإِمَامِ، وَلَيْسَ عِنْدَنَا فِي ذَلِكَ أَمْرٌ مَعْرُوفٌ مَوْثُوقٌ إِلَّا اجْتِهَادُ السُّلْطَانِ، وَلَمْ يَبْلُغْنِي، أَنَّ رَسُولَ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ : " نَفَّلَ فِي مَغَازِيهِ كُلِّهَا "، وَقَدْ بَلَغَنِي أَنَّهُ نَفَّلَ فِي بَعْضِهَا يَوْمَ حُنَيْنٍ، وَإِنَّمَا ذَلِكَ عَلَى وَجْهِ الْاجْتِهَادِ مِنَ الْإِمَامِ فِي أَوَّلِ مَغْنَمٍ وَفِيمَا بَعْدَهُ
Imam Malik, may Allah have mercy on him, was asked whether the nafl (voluntary share) used to be given from the spoils first. He replied that this depends on the opinion of the Imam; there is no fixed rule in this regard. And the Messenger of Allah, peace and blessings be upon him, did not prescribe nafl in every battle, but only in some battles, such as Hunayn. So it depends on the opinion of the Imam, whether he prescribes the nafl before the distribution of the spoils or after it.