Surah Al-Anfal 8:67
مَا كَانَ لِنَبِىٍّ أَن يَكُونَ لَهُۥٓ أَسْرَىٰ حَتَّىٰ يُثْخِنَ فِى ٱلْأَرْضِ ۚ تُرِيدُونَ عَرَضَ ٱلدُّنْيَا وَٱللَّهُ يُرِيدُ ٱلْـَٔاخِرَةَ ۗ وَٱللَّهُ عَزِيزٌ حَكِيمٌ
It is not for a prophet to have captives [of war] until he inflicts a massacre [upon Allāh's enemies] in the land. You [i.e., some Muslims] desire the commodities of this world, but Allāh desires [for you] the Hereafter. And Allāh is Exalted in Might and Wise.
Translation: Saheeh International
Tafsir
The following was revealed when they ransomed those taken captive at Badr It is not for any Prophet to have read as an takūna lahu or an yakūna lahu prisoners until he has made slaughter in the land going all the way in fighting disbelievers. …
Excerpt from Tafsir al-Jalalayn, commentary on 8:67, via Quran.com. The reader has the full commentary and 9 more tafsirs.