Devarim (Deuteronomy): Shoftim > Ch 20
When you go to battle, don’t be afraid for G-d is with you
When you go out to war against your enemies, and you see horse and chariot, a people more numerous than you, you shall not be afraid of them, for the Lord, your G-d is with you Who brought you up out of the land of Egypt. And it will be, when you approach the battle, that the kohen shall come near, and speak to the people. And he shall say to them, "Hear, O Israel, today you are approaching the battle against your enemies. Let your hearts not be faint; you shall not be afraid, and you shall not be alarmed, and you shall not be terrified because of them. For the Lord, your G-d, is the One Who goes with you, to fight for you against your enemies, to save you.
If a man has built a new house, planted a vineyard, or got engaged, he is excused from battle
And the officers shall speak to the people, saying, What man is there who has built a new house and has not [yet] inaugurated it? Let him go and return to his house, lest he die in the war, and another man inaugurate it. And what man is there who has planted a vineyard, and has not [yet] redeemed it? Let him go and return to his house, lest he die in the war, and another man redeem it. And what man is there who has betrothed a woman and has not [yet] taken her? Let him go and return to his house, lest he die in the war, and another man take her." And the officers shall continue to speak to the people and say, "What man is there who is fearful and fainthearted? Let him go and return to his house, that he should not cause the heart of his brothers to melt, as his heart." And it shall be, that when the officials finish speaking to the people, they shall appoint officers of the legions at the edges of the people.
When you approach a city to wage war, you shall first propose peace
When you approach a city to wage war against it, you shall propose peace to it. And it will be, if it responds to you with peace, and it opens up to you, then it will be, [that] all the people found therein shall become tributary to you, and they shall serve you. But if it does not make peace with you, and it wages war against you, you shall besiege it, and the Lord, your G-d, will deliver it into your hands, and you shall strike all its males with the edge of the sword. However, the women, the children, and the livestock, and all that is in the city, all its spoils you shall take for yourself, and you shall eat the spoils of your enemies, which the Lord, your G-d, has given you. Thus you shall do to all the cities that are very far from you, which are not of the cities of these nations.
You shall utterly destroy Hittities, Amorites, Canaanites, Perizzites, Hivvites and Jebusites
However, of these peoples' cities, which the Lord, your G-d, gives you as an inheritance, you shall not allow any soul to live. Rather, you shall utterly destroy them: The Hittites, and the Amorites, the Canaanites, and the Perizzites, the Hivvites, and the Jebusites, as the Lord, your G-d, has commanded you. So that they should not teach you to act according to all their abominations that they have done for their G-ds, whereby you would sin against the Lord, your G-d.
When besieging a city, don’t cut down fruit trees
When you besiege a city for many days to wage war against it to capture it, you shall not destroy its trees by wielding an ax against them, for you may eat from them, but you shall not cut them down. Is the tree of the field a man, to go into the siege before you? However, a tree you know is not a food tree, you may destroy and cut down, and you shall build bulwarks against the city that makes war with you, until its submission.