The Holy One, blessed be He, caused Amalek and his people to fall into the hand of Joshua, as it is said, "And Joshua discomfited Amalek and his people with the edge of the sword" (Ex. 17:13).
Rabbi Shela said: The Holy One, blessed be He, wished to destroy, to cut off all the seed of Amalek. What did the Holy One, blessed be He, do? He put forth His right hand and took hold of the throne of His glory, and swore that He would destroy and cut off all the seed of Amalek, as it is said, "And he said, Because there is a hand against the throne of the Lord, the Lord will wage war against Amalek" (Ex. 17:16).