Deuteronomy 9:4-5

MLV(i) 4 Do not speak in your heart, after Jehovah your God has thrust them out from before you, saying, For my righteousness Jehovah has brought me in to possess this land. But because of the wickedness of these nations Jehovah drives them out from before you.
5 Not for your righteousness, or for the uprightness of your heart, do you go in to possess their land, but for the wickedness of these nations Jehovah your God drives them out from before you and that he may establish the word which Jehovah swore to your fathers, to Abraham, to Isaac and to Jacob.