5 Then the Lord said to Moses, "Pass before the people and take with you some of the elders of Israel; and take in your hand your staff with which you struck the Nile, and go.
6 Behold, I will stand before you there on the rock at Horeb; and you shall strike the rock, and water will come out of it, that the people may drink." And Moses did so in the sight of the elders of Israel.
7 He named the place Massah and Meribah because of the quarrel of the sons of Israel, and because they tested the Lord, saying, "Is the Lord among us, or not?"
8 Then Amalek came and fought against Israel at Rephidim.
9 So Moses said to Joshua, "Choose men for us and go out, fight against Amalek. Tomorrow I will station myself on the top of the hill with the staff of God in my hand."
10 Joshua did as Moses told him, and fought against Amalek; and Moses, Aaron, and Hur went up to the top of the hill.
11 So it came about when Moses held his hand up, that Israel prevailed, and when he let his hand down, Amalek prevailed.