“Be very resolute to keep and to do all that is written in the book of the Torah of Moses, so that you may not turn aside from it to the right or to the left, and not intermingle with these nations who are still remaining among you. Do not mention the names of their gods or swear by them or worship them or bow down to them. But cling to Adonai your God, as you have done to this day. For Adonai has driven out from before you great and mighty nations. As for you, no one remained standing before you to this day.
Joshua 23:6-9 TLV
Reading this scripture my interpretation is that my God who is all knowing and gracious awarded his chosen people the promise land with conditions. As long as the conditions are kept, God’s favor will continue to exist.