Deuteronomy 20:11-15

20:11 If it accepts your terms and submits to you, all the people found in it will become your slaves. 20:12 If it does not accept terms of peace but makes war with you, then you are to lay siege to it. 20:13 The Lord your God will deliver it over to you and you must kill every single male by the sword. 20:14 However, the women, little children, cattle, and anything else in the city – all its plunder – you may take for yourselves as spoil. You may take from your enemies the plunder that the Lord your God has given you. 20:15 This is how you are to deal with all those cities located far from you, those that do not belong to these nearby nations.