Amalek came and fought with Israel at Rephidim.
Moses said to Joshua, "Choose some men for us and go fight with Amalek. Tomorrow I'll stand on top of the hill with the shepherd's rod of God in my hand."
So Joshua did as Moses told him. He fought with Amalek while Moses, Aaron, and Hur went up to the top of the hill.
Whenever Moses held up his hand, Israel would start winning the battle. Whenever Moses lowered his hand, Amalek would start winning.
But Moses' hands grew tired. So they took a stone and put it under Moses so he could sit down on it. Aaron and Hur held up his hands, one on each side of him so that his hands remained steady until sunset.
So Joshua defeated Amalek and his army with the sword.
Then the LORD said to Moses, "Write this as a reminder on the scroll and read it to Joshua: I will completely wipe out the memory of Amalek under the sky."
Moses built an altar there and called it, "The LORD is my banner."
He said, "The power of the LORD's banner!a The LORD is at war with Amalek in every generation."