Why did God harden king Sihon's spirit?


So God could deliver him into Moses's hand

To kill him and all his people (including the women and little children), and take their land.
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, as appeareth this day.

And the LORD said unto me, Behold, I have begun to give Sihon and his land before thee: begin to possess, that thou mayest inherit his land.

Then Sihon came out against us, he and all his people, to fight at Jahaz.

And the LORD our God delivered him before us; and we smote him, and his sons, and all his people.

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: Deuteronomy 2:30-34