“As they began to sing and praise, Yahweh set an ambush against the men of Ammon, Moab, and Mount Seir, who had come against Judah, so that they were routed. The Ammonites and Moab rose and attacked the inhabitants of Mount Seir, destroying them utterly. When they had made an end of the inhabitants of Seir, they all helped to destroy one another.”
As the people sing praises to God, Yahweh set an ambush against the Ammonites, the Moabites, and the people of Mount Seir. What Yahweh often did was to confuse the enemies of Israel and Judah. For some unnamed reason, these groups began to fight with each other. Mount Seir is where Esau the brother of Jacob went so that this may be a reprisal against their descendents. King David had defeated the Ammonites a century or two earlier.