According to the Bible, the Moabites opposed the Israelite invasion of Canaan, as did the Ammonites. As a consequence, they were excluded from the congregation for ten generations (; comp. ). The term "tenth generation" is considered an idiom, used for an unlimited time, as opposed to the third generation, which allows an Egyptian convert to marry into the community. The Talmud expresses the view that the prohibition applied only to male Moabites, who were not allowed to marry born Jews or legitimate converts. Female Moabites, when converted to Judaism, were permitted to marry with only the normal prohibition of a convert marrying a kohen (priest) applying. However, the prohibition was not followed during the Exile, and Ezra and Nehemiah sought to compel a return to the law because men had been marrying women who had not been converted at all (, 12; ). The heir of King Solomon was Rehoboam, the son of an Ammonite woman, Naamah ().