(Psalm 97:7, end:) "ALL GODS BOW DOWN TO HIM." When He judges the peoples of the world, He will judge their gods along with them, as it is stated (in Isaiah 66:16): "FOR IN FIRE WILL THE LORD EXECUTE JUDGMENT…." Since they are unable to stand in the fire, they fly away. Then the Holy One, blessed be He, sends out angels with collars and chains, and they cast them into the midst of the fire, as it is stated (in Malachi 3:19): "AND THE DAY THAT COMES SHALL SET THEM ABLAZE…."
God Judges the Nations and Their Gods in Fire
Midrash Tanchuma Buber, Shoftim 10:1
(וישתחוו לך) [השתחוו לו] כל אלהים (תהלים צז ז), כשידין לאומות העולם ידין לאלהיהם עמהם, שנאמר כי באש ה' נשפט וגו' (ישעיה סו טז), כיון שאין יכולין לעמוד באש פורחין והקב"ה משלח מלאכים בקולרין ובשלשלאות, ומשליכין אותן לתוך האור, שנאמר ולהט אותם היום הבא וגו' (מלאכי ג יט).