Deuteronomy 23:5

5 Yet the Lord your God would not listen to Balaam, but He turned the curse into a blessing for you because the Lord your God loves you.[a]

Deuteronomy 23:5 In-Context

3 No Ammonite or Moabite may enter the Lord's assembly; none of their descendants, even to the tenth generation, may ever enter the Lord's assembly.
4 This is because they did not meet you with food and water on the journey after you came out of Egypt, and because Balaam son of Beor from Pethor in Aram-naharaim was hired to curse you.#fn
5 Yet the Lord your God would not listen to Balaam, but He turned the curse into a blessing for you because the Lord your God loves you.
6 Never seek peace or friendship with them as long as you live.
7 Do not despise an Edomite, because he is your brother. Do not despise an Egyptian, because you were a foreign resident in his land.

Footnotes 1

Holman Christian Standard Bible ® Copyright © 2003, 2002, 2000, 1999 by Holman Bible Publishers.  Used by permission.  All rights reserved.