20
When you go to war with your enemies and you see horses and chariots, and a larger army than yours, don't be afraid of them, because the Lord your God who led you out of Egypt is with you. Before you go into battle, the priest shall come and speak to the army. He is to tell them, “Listen, men of Israel! Today you are going to fight your enemies. Don't be nervous or afraid; don't be panicked or terrified by them. For the Lord your God is going with you to fight for you against your enemies, and he will give you the victory.”
The officers shall also speak to the army and tell them, “Is there any man here who has built a new house and hasn't dedicated it to the Lord?* “To the Lord”: implied. He can go home, otherwise he might die in battle and another man will dedicate it. Is there any man here who has planted a vineyard and hasn't yet enjoyed its fruit? He can go home, otherwise he might die in battle and another man will enjoy its fruit. Is there any man here who is engaged to a woman and hasn't married her? He can go home, otherwise he might die in battle and another man will marry her.”
The officers are also to tell the army, “Is there any man here who is afraid or nervous? He can go home, so he won't affect his fellow-soldiers and make them as frightened as himself.”
After the officers have finished speaking to the army, they are put commanders in charge to lead it into battle.
10 When you arrive at a town, ready to attack it, you must first make an offer of peace to the people living there. 11 If they accept your offer of peace and open their gates to you, all the inhabitants will become your slave-laborers.
12 However, if they refuse to make peace with you and decide to fight you, then lay siege to the town. 13 Once the Lord your God has handed it over to you, kill every male with the sword. 14 But you can take as plunder the women, children, livestock, and everything else in the town. You can take and use all your enemies' possessions the Lord your God gives you. 15 This is the way you are to deal with all the towns that are a long way from you and don't belong to neighboring nations.
16 However, when it comes to the towns of those nations whose land the Lord your God is giving you to occupy, don't leave anything alive that breathes. 17 Set them apart for complete destruction—the Hittites, Amorites, Canaanites, Perizzites, Hivites, and Jebusites—as the Lord your God has ordered you to do. 18 This is to prevent them teaching you all the offensive things they do in worshiping their gods, and in so doing make you sin against the Lord your God.
19 Now when you lay siege to a town and it goes on for a long time as you fight to capture it, don't destroy the fruit trees there. You can eat their fruit. Don't cut them down. Are the trees in the orchard human beings that you should also attack? 20 However, you may destroy the trees that you know are not fruit trees. You can use them to build siege equipment to attack the town that is fighting against you until it falls.

*20:5 “To the Lord”: implied.