Dee is correct;
Tha Amalekites ambushed the Israelites..killing many, including women and children. (1 Sam 15) So God told Saul to go punish the Amalekites, slaying all..
Saul was directly ordered to kill King Agag...but Saul disobeyed..and it later cost him his kingdom.
Since Saul disobeyed, it unwittingly threatened the Jews much later. Saul spared Agag about 1000 BC, about 500 years later Haman, a direct
descendant of King Agag, tried to have all the Jews in the kingdom murdered. ..But God provided Esther, to be queen of the Medes and Persians, and save her people
We should not try to second-guess God..