Deuteronomy 20:10-18 World English Bible (WEB)
10 When you draw near to a city to fight against it, then proclaim peace to it. 11 It shall be, if it makes you answer of peace, and opens to you, then it shall be, that all the people who are found therein shall become forced laborers to you, and shall serve you. 12 If it will make no peace with you, but will make war against you, then you shall besiege it. 13 When Yahweh your God delivers it into your hand, you shall strike every male of it with the edge of the sword; 14 but the women, the little ones, the livestock, and all that is in the city, even all its plunder, you shall take for plunder for yourself. You may use the plunder of your enemies, which Yahweh your God has given you. 15 Thus you shall do to all the cities which are very far off from you, which are not of the cities of these nations. 16 But of the cities of these peoples, that Yahweh your God gives you for an inheritance, you shall save alive nothing that breathes; 17 but you shall utterly destroy them: the Hittite, the Amorite, the Canaanite, the Perizzite, the Hivite, and the Jebusite; as Yahweh your God has commanded you; 18 that they not teach you to follow all their abominations, which they have done to their gods; so would you sin against Yahweh your God.
Deuteronomy 20:10-18 New International Version (NIV)
10 When you march up to attack a city, make its people an offer of peace. 11 If they accept and open their gates, all the people in it shall be subject to forced labor and shall work for you. 12 If they refuse to make peace and they engage you in battle, lay siege to that city. 13 When the Lord your God delivers it into your hand, put to the sword all the men in it. 14 As for the women, the children, the livestock and everything else in the city, you may take these as plunder for yourselves. And you may use the plunder the Lord your God gives you from your enemies. 15 This is how you are to treat all the cities that are at a distance from you and do not belong to the nations nearby.
16 However, in the cities of the nations the Lord your God is giving you as an inheritance, do not leave alive anything that breathes. 17 Completely destroy[a] them—the Hittites, Amorites, Canaanites, Perizzites, Hivites and Jebusites—as the Lord your God has commanded you. 18 Otherwise, they will teach you to follow all the detestable things they do in worshiping their gods, and you will sin against the Lord your God.