The king of Ai he hanged on a tree until the evening: and at the going down of the sun Joshua commanded, and they took his body down from the tree, and cast it at the entrance of the gate of the city, and raised thereon a great heap of stones, to this day.
God purposely delivered the king alive into the hand of Joshua, that his punishment might be more marked and thus better adapted for an example. Had he fallen in the conflict promiscuously with others, he would have been exempted from this special mark of infamy; but now even after his death, the divine vengeance pursues his corpse. Nay, after being hung, he is thrown forth at the gate of the city where he had sat on his throne in judgment, and a monument is erected for the purpose of perpetuating his ignominy to posterity. His burial, however, is mentioned to let us know that nothing was done through tumultuous impetuosity, as Joshua carefully observed what Moses had prescribed in the Law, (Deuteronomy 21:23) namely, that those hung on gibbets should be taken down before sunset, as a spectacle of the kind was held in abomination. And, certainly, while it is humane to bury the dead under ground, it is inhumanly cruel to cast them forth to be torn by wild beasts or birds. Therefore, that the people might not be accustomed to barbarity, God allowed criminals to be hung, provided they did not hang unburied for more than one day. And that the people might be more attentive to this duty, which otherwise might readily have been neglected, Moses declares that every one who hangs on a tree is accursed; as if he had said, that the earth is contaminated by that kind of death, if the offensive object be not immediately taken away. 