The Lord had given the people in the Land of Canaan centuries to repent, but the time expired and He wanted them removed from the land completely.
Joshua carried this out with Hazor, which was north of the Sea of Galilee,
“Joshua turned back at that time and took Hazor, and struck its king with the sword; for Hazor was formerly the head of all those kingdoms. And they struck all the people who were in it with the edge of the sword, utterly destroying them. There was none left breathing. Then he burned Hazor with fire. So all the cities of those kings, and all their kings, Joshua took and struck with the edge of the sword. He utterly destroyed them, as Moses the servant of the LORD had commanded” (Joshua 11:10-12).
If only the Israelites had continued doing that, then what you read in the Book of Judges would not have taken place, but by failing to rid the land of all the people, Israel became ensnared in the sins of the Canaanites, which eventually brought the downfall of Israel.
Let us be sure to carry out the Lord’s commands fully, whatever they are.