3 "'Now go and attack Amalek, and utterly destroy all that they have, and do not spare them. But kill both man and woman, infant and nursing child, ox and sheep, camel and donkey.'" -1 Samuel 15:3

16 "Fathers shall not be put to death for their children, nor shall children be put to death for their fathers; a person shall be put to death for his own sin." -Deuteronomy 24:16

4 However he did not execute their children, but did as it is written in the Law in the Book of Moses, where the LORD commanded, saying, "The fathers shall not be put to death for their children, nor shall the children be put to death for their fathers; but a person shall die for his own sin." -2 Chronicles 25:4

The Problem
The Israelites contradict their own law when they kill innocent Amalekite children.

The Answer
First, note that the Mosaic law kept by Amaziah in 2 Chronicles comes from Deuteronomy 24:16.

It was God's command, and not the Israelite's own plans, to kill the Amalekites. The book of Deuteronomy was written for the Jewish people to keep, not God. Though we may not like it, God does not share rights. (In fact, humans do not have any rights---only grace. We all deserve to die. Therefore, rather than asking, Why were the Amalekites killed?, one should wonder, Why has God allowed me to live?) This may seem unfair, but only in the same way that a parent forbids a little child from crossing the street alone, whereas the parent may do so freely. Post-Fall humans are merely the finite children of an infinite God. Humans cannot foresee the future or comprehend God's will, therefore we can only trust that God's decisions are wise and just. And in the case of the Amalekites, God's decision was very just, no doubt reinforcing the seriousness of His covenant with Abraham (Genesis 12:3): those who harm Israel will feel God's anger.

Other instances of God commanding the death of innocent children include the Saul's seven grandsons (2 Samuel 21:5-9) and David and Bathsheba's first son (2 Samuel 12:14).

Contrary to the shallow interpretations skeptics often derive from Scripture, God does not spontaneously slay people out of selfish fits of divine anger. Rather, He has a very specific purpose that reflects His justice and goodness. Learn more about supposed Bible atrocities.

A great question to ask any skeptic who brings up this passage is, What is your stance on abortion? Often enough, those who complain about God the most value the sanctity of life the least.

Bible Apologetics Index