Deuteronomy 9:4-5

CLV(i) 4 Do not say in your heart when Yahweh your Elohim thrusts them out from before you, saying:Because of my own righteousness Yahweh brings me in to tenant this land. Rather it is because of the wickedness of these nations that Yahweh is evicting them before your face. 5 It is not because of your own righteousness or the uprightness of your own heart that you are entering to tenant their country, for it is because of the wickedness of these nations that Yahweh your Elohim is evicting them before your face, so that He may confirm the word that Yahweh had sworn to your fathers, to Abraham, to Isaac and to Jacob.