Because God fought for them, they killed many of the enemy. They dispossessed the Hagrites and lived in their land until the exile.
But Amaziah did not heed the warning, for God wanted to hand them over to Joash because they followed the gods of Edom.