Rise ye up, take your journey, and pass over the river Arnon: behold, I have given into thine hand Sihon the Amorite, king of Heshbon, and his land: begin to possess it, and contend with him in battle. Deuteronomy 2:24
God tells them to terrorize the current occupants of the land they are about to steal. The entire world will fear, tremble, and anguish at the very thought of them.
This day will I begin to put the dread of thee and the fear of thee upon the nations that are under the whole heaven, who shall hear report of thee, and shall tremble, and be in anguish because of thee. 2:25
The Israelites begin by lying about their true intentions. They send messengers to King Sihon asking to pass through his land, promising to pay for food and water along the way.
I sent messengers ... unto Sihon king of Heshbon with words of peace, saying, Let me pass through thy land: I will go along by the high way, I will neither turn unto the right hand nor to the left. Thou shalt sell me meat for money, that I may eat; and give me water for money, that I may drink: only I will pass through on my feet. 2:26-28
But then God runs into a bit of a problem. What if King Sihon agrees to let the Israelites pass through his land? Then the Israelites wouldn't get to kill all of his people. So God has a brilliant idea: he'll harden King Sihon's heart so that he won't let them pass. [It worked so well with the Pharaoh (9?) that God thought he'd try it again here.]
But Sihon king of Heshbon would not let us pass by him: for the LORD thy God hardened his spirit, and made his heart obstinate, that he might deliver him into thy hand. 2:30
And God's plan worked perfectly. After God hardened King Sihon's heart, he refused to let the Israelites pass and fought to protect his land. Which gave God and the Israelites all the excuse they needed to kill the king along with every man, woman, and child in every city in the kingdom.
And the LORD our God delivered him before us; and we smote him, and his sons, and all his people. And we took all his cities at that time, and utterly destroyed the men, and the women, and the little ones, of every city, we left none to remain. ... There was not one city too strong for us: the LORD our God delivered all unto us. 2:33-36
Sometimes God has to harden a heart in order to kill thousands of people.
Since everyone in every city was killed, and there seemed to be quite a few, I guessed 1000 were killed from each of five cities, for a total of 5000.