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.