Imam Ahmad recorded that Anas said, "The Prophet asked the people for their opinion about the prisoners of war of Badr, saying,

«إِنَّ اللهَ قَدْ أَمْكَنَكُمْ مِنْهُم»

(Allah has made you prevail above them.) `Umar bin Al-Khattab stood up and said, `O Allah's Messenger! Cut off their necks,' but the Prophet turned away from him. The Messenger of Allah ﷺ again asked,

«يَاأَيُّهَا النَّاسُ إِنَّ اللهَ قَدْ أَمْكَنَكُمْ مِنْهُمْ وَإِنَّمَا هُمْ إِخْوَانُكُمْ بِالْأَمْس»

(O people! Allah has made you prevail over them, and only yesterday, they were your brothers.) `Umar again stood up and said, `O Allah's Messenger! Cut off their necks.' The Prophet ignored him and asked the same question again and he repeated the same answer. Abu Bakr As-Siddiq stood up and said, `O Allah's Messenger! I think you should pardon them and set them free in return for ransom.' Thereupon the grief on the face of Allah's Messenger ﷺ vanished. He pardoned them and accepted ransom for their release. Allah, the Exalted and Most Honored, revealed this verse,

لَّوْلاَ كِتَـبٌ مِّنَ اللَّهِ سَبَقَ لَمَسَّكُمْ فِيمَآ أَخَذْتُمْ عَذَابٌ عَظِيمٌ

(Were it not a previous ordainment from Allah, a severe torment would have touched you for what you took)."

`Ali bin Abi Talhah narrated that Ibn `Abbas said about Allah's statement,

لَّوْلاَ كِتَـبٌ مِّنَ اللَّهِ سَبَقَ

(Were it not a previous ordainment from Allah...),

"In the Preserved Book, that war spoils and prisoners of war will be made allowed for you,

لَمَسَّكُمْ فِيمَآ أَخَذْتُمْ

(would have touched you for what you took), because of the captives.

عَذَابٌ عظِيمٌ

(a severe torment.) Allah, the Exalted said next,

فَكُلُواْ مِمَّا غَنِمْتُمْ حَلَـلاً طَيِّباً

(So enjoy what you have gotten of booty in war, lawful and good)." eAl-`Awfi also reported this statement from Ibn `Abbas. A similar statement was collected from Abu Hurayrah, Ibn Mas`ud, Sa`id bin Jubayr, `Ata', Al-Hasan Al-Basri, Qatadah and Al-A`mash. They all stated that,

لَّوْلاَ كِتَـبٌ مِّنَ اللَّهِ سَبَقَ

(Were it not a previous ordainment from Allah. .) refers to allowing the spoils of war for this Ummah.

Supporting this view is what the Two Sahihs recorded that Jabir bin `Abdullah said that the Messenger of Allah ﷺ said,

«أُعْطِيتُ خَمْسًا لَمْ يُعْطَهُنَّ أَحَدٌ مِنَ الْأَنْبِيَاءِ قَبْلِي: نُصِرْتُ بِالرُّعْبِ مَسِيرَةَ شَهْرٍ، وَجُعِلَتْ لِيَ الْأَرْضُ مَسْجِدًا وَطَهُورًا، وَأُحِلَّتْ لِيَ الْغَنَائِمُ وَلَمْ تُحَلَّ لِأَحَدٍ قَبْلِي، وَأُعْطِيتُ الشَّفَاعَةَ، وَكَان النَّبِيُّ يُبْعَثُ إِلَى قَوْمِهِ، وَبُعِثْتُ إِلَى النَّاسِ عَامَّة»

(I have been given five things which were not given to any Prophet before me. (They are:) Allah made me victorious by awe, (by His frightening my enemies) for a distance of one month's journey. The earth has been made a place for praying and a purifyer for me. The booty has been made lawful for me, yet it = was not lawful for anyone else before me. I have been given the right of intercession (on the Day of Resurrection). Every Prophet used to be sent to his people only, but I have been sent to all mankind.)

Al-A`mash narrated that Abu Salih said that Abu Hurayrah said that the Messenger of Allah ﷺ said,

«لَمْ تَحِلَّ الْغَنَائِمُ لِسُودِ الرُّؤُوسِ غَيْرَنَا»

(War booty was never allowed for any among mankind except us.) Abu Hurayrah said; This is why Allah the Most High said,

فَكُلُواْ مِمَّا غَنِمْتُمْ حَلَـلاً طَيِّباً

(So enjoy what you have gotten of booty in war, lawful and good.)

The Muslims then took the ransom for their captives. In his Sunan, Imam Abu Dawud recorded that Ibn `Abbas said that the Messenger of Allah ﷺ fixed four hundred (Dirhams) in ransom from the people of Jahiliyyah in the aftermath of Badr. The majority of the scholars say that the matter of prisoners of war is up to the Imam. If he decides, he can have them killed, such as in the case of Bani Qurayzah. If he decides, he can accept a ransom for them, as in the case of the prisoners of Badr, or exchange them for Muslim prisoners. The Messenger ﷺ exchanged a woman and her daughter who were captured by Salamah bin Al-Akwa`, for exchange of some Muslims who were captured by the idolators, or if he decides he can take the prisoner as a captives.