Deuteronomy 9:5

5 Not for thy righteousness or for the uprightness of thine heart, dost thou enter in to inherit their land; but for the wickedness of these Gentiles, the LORD thy God drives them out from before thee and that he may confirm the word which the LORD swore unto thy fathers, Abraham, Isaac, and Jacob.

Deuteronomy 9:5 In-Context

3 Understand, therefore, this day that the LORD thy God is he who passes before thee; as a consuming fire he shall destroy them and humble them before thee, and thou shalt drive them out and destroy them quickly, as the LORD has said unto thee.
4 Think not in thine heart, after the LORD thy God has cast them out from before thee, saying, Because of my righteousness the LORD has brought me in to inherit this land; rather for the wickedness of these Gentiles the LORD drives them out from before thee.
5 Not for thy righteousness or for the uprightness of thine heart, dost thou enter in to inherit their land; but for the wickedness of these Gentiles, the LORD thy God drives them out from before thee and that he may confirm the word which the LORD swore unto thy fathers, Abraham, Isaac, and Jacob.
6 Understand, therefore, that the LORD thy God does not give thee this good land to inherit because of thy righteousness, for thou art a stiffnecked people.
7 Remember, and forget not, how thou hast provoked the LORD thy God to wrath in the wilderness; from the day that thou didst depart out of the land of Egypt until ye came unto this place, ye have been rebellious against the LORD.
The Jubilee Bible (from the Scriptures of the Reformation), edited by Russell M. Stendal, Copyright © 2000, 2001, 2010