Deuteronomy 9:4 NIV

4 After the LORD your God has driven them out before you, do not say to yourself,1 "The LORD has brought me here to take possession of this land because of my righteousness." No, it is on account of the wickedness2 of these nations3 that the LORD is going to drive them out before you.

References for Deuteronomy 9:4