5 The Lord said to Moses, “Take some of the leaders of Israel with you, and go on ahead of the people. Take along the stick with which you struck the Nile.
6 I will stand before you on a rock at Mount Sinai. Strike the rock, and water will come out of it for the people to drink.” Moses did so in the presence of the leaders of Israel.
7 The place was named Massah and Meribah, because the Israelites complained and put the Lord to the test when they asked, “Is the Lord with us or not?”
8 The Amalekites came and attacked the Israelites at Rephidim.
9 Moses said to Joshua, “Pick out some men to go and fight the Amalekites tomorrow. I will stand on top of the hill holding the stick that God told me to carry.”
10 Joshua did as Moses commanded him and went out to fight the Amalekites, while Moses, Aaron, and Hur went up to the top of the hill.
11 As long as Moses held up his arms, the Israelites won, but when he put his arms down, the Amalekites started winning.