Deuteronomy 9:4-5

ISV(i) 4 After the LORD has expelled them before you, you are not to say to yourselves, ‘The LORD caused me to enter and possess this land because of my righteousness.’ 5 On the contrary, it is because of the wickedness of these nations that the LORD is dispossessing them before you to confirm what the LORD promised by an oath to your ancestors Abraham, Isaac, and Jacob.