Israel had been given the land and was supposed to defeat the inhabitants. They were deceived into making a treaty with people they thought were from outside their land. Had they asked God for direction, they would have known not to make the treaty. Having made the treaty, they were obligated to honor it.
Just like us, the people try to follow God, but find themselves being deceived from time to time. There was probably some pride involved when these people told Israel how famous they were, even from a long way off. Compliments may sound great, but can cause us to forget to rely on God.