Then he took the crown of their king from his head; and its weight was a talent of gold, and in it was a precious stone; and it was placed on David’s head. And he brought out the spoil of the city in a very great amount. He also brought out the people who were in it and set them up with saws, sharp iron instruments, and iron axes, and made them pass through the brickkiln. And thus he used to do to all the cities of the sons of Ammon. Then David and all the people returned to Jerusalem.” 2 Samuel 12:30-31 LSB https://bible.com/bible/3345/2sa.12.30-31.LSB
When Israel was conquering the Promised Land, they were charged with putting all of the current inhabitants to death. While God had given these inhabitants 400 years to repent, they only became more vile in His sight. Israel had the difficult job of exterminating these people, which they did poorly either by their disobedience or by God’s grace. Who often exhibits an unwillingness to remove men who sin against Him in the Scripture completely. David is recorded in these verses as extremely harsh with one of these people groups. It is the only record of torturous death being brought to a conquered people in the Bible. Perhaps David was feeling guilty and angry over his recent murder of his friend, whose wife he took while Uriah was away at this very battle. David arrives for the wrap-up of the war, having previously stayed home with the women, where he finds nothing better to do than commit adultery and plan murder. David should have been with the men; both his future and the future of the Ammonites might have been different. God is always good, but He allows men to do what they will for the most part. Our will can be evil and cruel, particularly in foul moods. God has come in Jesus to pay for our sins, and now we can turn to Jesus and the power of His Holy Spirit to change us so that our responses to life are no longer revenge but love. God did not take revenge upon the world but loved the world, laying down His life for the world, so we must love sacrificially to demonstrate God’s great grace and mercy for everyone. We can do this through Him Who is greater in us than those in the world causing evil.