It is not for a prophet to have captives [of war] until he inflicts a massacre [upon Allah ’s enemies] in the land. Some Muslims desire the commodities of this world, but Allah desires [for you] the Hereafter. And Allah is Exalted in Might and Wise.
Quran - Verse : 67, Surah : Al-Anfal : 8, Chapter : The Spoils of War | 8:67

مَا كَانَ لِنَبِيٍّ أَن يَكُونَ لَهُ أَسْرَىٰ حَتَّىٰ يُثْخِنَ فِي الْأَرْضِ ۚ تُرِيدُونَ عَرَضَ الدُّنْيَا وَاللَّهُ يُرِيدُ الْآخِرَةَ ۗ وَاللَّهُ عَزِيزٌ حَكِيمٌ
القرآن الكريم - آیة : 67، سورة الْأَنْفَال : 8 | 8:67