After destroying Jericho, the Israelites next went to the city of Ai, killed everyone there with swords, stole all their belongings, and burned down the city. When the nearby people of Gibeon heard about that, they figured out a way to keep the same thing from happening to them. They asked Joshua to make a treaty with them.
God had forbidden the Israelites to make a treaty with the people who lived in the land they were taking over, so when Joshua asked, the Gibeonites said they lived far away. So Israel made a treaty of peace with Gibeon and swore not to attack them.
Three days later, the Israelites found out that the Gibeonites actually lived nearby. Joshua couldn’t understand why the Gibeonites would deceive him like that, so he asked them. The Gibeonites explained that they had heard that Israel was planning to kill everyone in the land, and the Gibeonites didn’t want to die. Joshua didn’t think God would like it if they killed the Gibeonites now, because then they would be breaking their promise to disobey God. So instead, Joshua enslaved the Gibeonites, because that seemed good and right to him.
The Israelites continued to murder nearly everyone in the land of the Hittites, Girgashites, Amorites, Canaanites, Perizzites, Hivites and Jebusites, as the Lord had commanded them. Anyone they couldn’t exterminate, they enslaved. And with all those native inhabitants out of the way, the Israelites settled in the promised land.
The moral of the story
If God wants you dead, you can save yourself by lying.