Deuteronomy 23:2-8

23:2 A person of illegitimate birth may not enter the assembly of the Lord; to the tenth generation no one related to him may do so.

23:3 An Ammonite or Moabite may not enter the assembly of the Lord; to the tenth generation none of their descendants shall ever do so, 23:4 for they did not meet you with food and water on the way as you came from Egypt, and furthermore, they hired Balaam son of Beor of Pethor in Aram Naharaim to curse you. 23:5 But the Lord your God refused to listen to Balaam and changed the curse to a blessing, for the Lord your God loves you. 23:6 You must not seek peace and prosperity for them through all the ages to come. 23:7 You must not hate an Edomite, for he is your relative; you must not hate an Egyptian, for you lived as a foreigner in his land. 23:8 Children of the third generation born to them may enter the assembly of the Lord.