Law about war.
The Israelites aren’t naturally warlike, but they are uniquely chosen in human history and God is promising to be on their side.
There are numerous exemptions from being part of the army, including being “faint hearted”. God likes to win with less rather than more manpower to make his God power clear. He only wants the motivated true believers who have no distractions.
The rules are relatively merciful (given that it’s war) for towns they need to conquer that aren’t in the promised land. There must always be a peace offer first, the women and children are spared.
But the towns within Canaan are under God’s judgment, the Israelites are mere vehicles of it, and nothing is to be spared. The Israelites did not have the stomach for that and their compromise was the downfall of their society.
The rules for selecting the army show God being supportive and compassionate… If you’ve just married or just built a house, you don’t have to fight.
The rules for standard warfare show God bringing fairness to the affairs of men. If war must be, the standard operation is reasonable, much moreso than the surrounding nations would have been I’m sure.
The rules for taking the land are those of a god who is mighty, has plans beyond our understanding, of our creator and our judge.
It’s all the one God. We can love and find joy in his compassion and fairness, but we also need to fearfully respect his greatness and power over us as his creatures and trust the wisdom of his plans.
It’s who he is, he lets us like him or lump him.