2 Chronicles 25:20

But Amaziah would not hear; for it came of God, that he might deliver them into the hand of their enemies, because they sought after the gods of Edom.

The verse belongs to the history running from 2 Chronicles 25 through Ezra 5 that covers ground previously covered in Kings, with additional interesting items not in the parallel books, especially a fuller history of the kings of Judah. Within that history, it belongs to the account of the unstable Amaziah. Departing from God brings strife and captivity and great loss, when remembering God would have made things very different. The chapter teaches that money already invested is no reason to continue a wrong course, since Amaziah could obey God's warning and trust that God was able to provide much more than the hundred talents he had spent. That lesson about abandoning a wrong course stands distinct from the verse's specific statement about God's purpose in Amaziah's refusal and about seeking after the gods of Edom.