1 Samuel 15:2

Thus saith the LORD of hosts, I remember that which Amalek did to Israel, how he laid wait for him in the way, when he came up from Egypt.

Thus saith the LORD of hosts, I remember that which Amalek did to Israel, means that God remembered how Amalek laid wait in ambush for Israel on the way when Israel came up from Egypt after the exodus. That remembered ambush and hostility was the reason God commanded Saul to attack Amalek and to carry out judgment upon them, sparing none of its people or possessions. Amalek had been the first to make war on Israel in the wilderness.

Its attack was cruel, idolatrous defiance of God. It threatened to destroy Israel and vowed to destroy Israel, mocked the fears of the people and the wonders God had done to deliver them, and boasted that Israel's God could not save them and that its own power could defeat Him. That sin brought a sentence of judgment recorded through Moses and delayed for four hundred years. The Amalekites did not turn from their sins and remained a threat to God's people and worship, so the time had come for the sentence to be carried out.

The verse belongs to the Lord's renewed commission to Saul, delivered through His prophet after Saul's earlier failures. It gave Saul a definite task and an opportunity to correct past errors, which accepted humbly could have turned those failures into victory. On the basis of that remembered hostility, God commanded Saul to attack Amalek and utterly destroy its people and possessions, sparing none. Israel's campaign was to be an act of obedience, not a way to gain honor or spoil, and Saul was not left free to decide whether to obey or spare, since God's commands are not optional or subject to human preference.

God appointed Amalek's destruction to be carried out by the people it had despised, so that the nations would see the end of its pride and power and take its fate as a warning. The commission tested Saul's obedience. By sparing Agag and the best livestock instead of carrying out the command, Saul disobeyed, and his failure to smite Amalek and utterly destroy them brought God's wrath upon him.