In the ancient context, the execution of the king of Ai and the subsequent display of his body was a common practice to signify a complete and decisive victory. It was a demonstration of power and a warning to other nations about the consequences of opposing the Israelites, who were under God's protection and guidance. The act of impaling and later burying the king under a pile of rocks was not only a military strategy but also a spiritual one, emphasizing the importance of following God's commands.
Joshua's leadership is highlighted here as he follows God's instructions meticulously, ensuring that the victory is not just physical but also spiritual. The pile of rocks served as a memorial, a physical reminder to the Israelites of God's faithfulness and the fulfillment of His promises. It also reminded them of the importance of obedience and the consequences of sin, as seen in the previous defeat at Ai due to Achan's disobedience. This event taught the Israelites about the seriousness of sin and the necessity of aligning with God's will to achieve success.