Deuteronomy 23:3-5

Thomson(i) 3 An Amorite, and a Moabite, shall not come into the congregation of the Lord: even to the tenth generation, they shall not come into the congregation of the Lord; nay; even for ever; 4 because they did not meet you with bread and water on the way, when you were coming out of Egypt; and because they hired against thee, Balaam, son of Beor, of Mesopotamia, to curse thee; 5 but the Lord thy God would not hearken to Balaam. Nay, the Lord thy God turned the curses into a blessing, because the Lord thy God loved thee.