When the Israelites went into the Promised Land, they began conquering the various kingdoms. After a couple of victories, some of the inhabitants of the land got scared. To make a long story short, some of the locals, the Gibeonites, tricked the Israelites into making a treaty with them.
It should not have happened. The Lord had told them before going into the land how to handle the inhabitants. But the Gibeonites pulled a fast one. They were clever, and fooled the Israelites with a bit of deception. The Israelites did not ask God about the treaty idea. They just did it on their own. They were wrong, but they did it anyway.
So did that suddenly disqualify them from God’s blessings? Did the Lord leave them as a result of their disobedience?
Well, if you read the rest of the story, you’ll find the answer. Some of the other local kingdoms didn’t like the fact that the Gibeonites had signed a treaty with the invaders. So five other kingdoms banded together to teach them a lesson. But as a result of the treaty, Joshua and the Israelites stepped in to lend a hand. So what happened? God brought all of those enemies together so the Israelites didn’t need to go find them. He actually blessed Joshua and company in spite of their transgression.
For those who love God, all things work together for good. Not just the positive ones. Somehow the Lord weaves even our stupid and sinful mistakes into His plans.