Deuteronomy 9:5

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 the LORD your God does drive them out from before you, and that he may establish the word which the LORD swore to your fathers, to Avraham, to Yitzchak, and to Ya`akov.

Deuteronomy 9:5 In-Context

3 Know therefore this day, that the LORD your God is he who goes over before you as a devouring fire; he will destroy them, and he will bring them down before you: so shall you drive them out, and make them to perish quickly, as the LORD has spoken to you.
4 Don't speak in your heart, after that the LORD your God has thrust them out from before you, saying, For my righteousness the LORD has brought me in to possess this land; whereas for the wickedness of these nations the LORD does drive 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 the LORD your God does drive them out from before you, and that he may establish the word which the LORD swore to your fathers, to Avraham, to Yitzchak, and to Ya`akov.
6 Know therefore, that the LORD your God doesn't give you this good land to possess it for your righteousness; for you are a stiff-necked people.
7 Remember, don't forget, how you provoked the LORD your God to wrath in the wilderness: from the day that you went forth out of the land of Mitzrayim, until you came to this place, you have been rebellious against the LORD.
The Hebrew Names Version is in the public domain.