The Lord told Moses to go to Horeb, smite the rock and there would be water. There was water and the next thing you know here comes Amalek. As soon as he heard about the water, he begins an unprovoked attack on the Israelites. Moses tells Joshua to pick some men and go fight Amalek.
Regress a little bit. Esau had taken his family and his possessions and settled Edom (it means 'red'). Jacob remained in Canaan. Famine struck Egypt and Canaan. Because of Joseph, a son of Jacob's, the Israelites had a way out of the famine. They went to Egypt only to eventually become slaves. Edom which lay south of Judah and the Dead Sea had set up a monarchy which lasted for years. It's in Genesis 36:31-39.
Twin brothers, one lived 'in the flesh' while the other lived 'in the spirit'. The account of what happens to Esau's bunch is in Obadiah. Also, another side note: Edom was also known as Idumea. Herod was an Idumean.
Moses is now dealing with Amalek. Joshua has picked his men and the fight begins. Moses stands on the hilltop and raises his hands with the staff in it. As long as his hands are up, Joshua and his men are winning the battle. But, Moses becomes tired. He's stood for a long time and his arms are growing weary. When he put his hands down, the battle turned against them. He raises his arms. This time he has help from Hur and Aaron. They help to hold his arms up until the sun goes down and the battle is won.
Joshua and his men won the battle. Or so it would seem. After the battle, the Lord tells Moses to write down an account of the battle and to recite what happened, what actually happened. The Lord fought with them and the battle was won. A great reminder when we get too big for our britches.
Up until this event, the Lord's people were much like sheep. Now, they must become His warriors. And Joshua was the man for the job. He would later be the one to take the place of Moses and lead them into the promised land. By the time the walls of Jericho fell, he knew that God would win the fight.
God, our omnipotent God, gave man a choice. He gave His right to choose to us. We all have choices to make. The person who feels drawn to the Lord will make choices in favor of the Lord. Those who have no compelling force to draw them to Christ, will ultimately pay by losing the battle. Only God wins the battles. They grow weary like Moses did during the fight with the Amalekites. But Moses had a sustaining force to keep him going. We must have a sustaining force, too. Once we're drawn to the Lord, we appeal to Him for victory. Then, choose what to do. God will not fail you. He will answer you.