The Amalekites attacked the Israelites without provocation when they left Egypt during the Exodus.
(Exodus 17:8)
They attacked them again after the wars in Canaan.
(Judges 3:12-13; Eglon, king of Moab, joined with the Ammonites and Amalekites to attack Israel. Israel became slaves to the king of Moab for 18 years.)
The Amalekites would wait until Israelites planted, and when they were ready to harvest, they would raid their lands, leaving the Israelites to starve. (Judges 6:1-4)
The Judges account gives the best explanation for why God told Saul to destroy them. It was, an eye for an eye.
When the Midianites and Amalekites attacked Israel, the bible says they camped on the land, ruined the crops all the way to the Gaza, and "did not spare a living thing for Israel, neither sheep nor cattle nor donkeys. They came up with their livestock and their tents like swarms of locusts. It was impossible to count the men and their camels; they invaded the land to ravage it."
This was a long, long history of father passing down to son the belief that it was okay to wipe out and starve out Israel.
This was time after time after time when God spared them, and they repeated the process.
This was "an eye for an eye."
The women and children were as guilty as the men. The weaker participants were as responsible for the starvation of Israel as the warriors were.
Eventually, it became clear, the only way to end this was to wipe out the tribe.
Now, if you wiped out the warriors, you left the women and children to slowly die of starvation and exposure. You left them with an unbearably painful death.
So, this was ALSO mercy.