But at the time of the going down of the sun, Joshua commanded, and they took them down from the trees and threw them into the cave where they had hidden themselves, and they set large stones against the mouth of the cave, which remain to this very day.
Joshua 10:27

Joshua respected the image of God in his defeated enemies. Although he treated them spitefully, he treated God's image in their corpses with respect when he took them down from the trees on which they had been hung and buried them as God commanded in Deuteronomy 21:22-23.