Deuteronomy 23:3-5

MSB(i) 3 No Ammonite or Moabite or any of their descendants may enter the assembly of the LORD, even to the tenth generation. 4 For they did not meet you with food and water on your way out of Egypt, and they hired Balaam son of Beor from Pethor in Aram-naharaim to curse you. 5 Yet the LORD your God would not listen to Balaam, and the LORD your God turned the curse into a blessing for you, because the LORD your God loves you.