The Torah tells us that during the six weeks period between Kriyat Yamsuf and the Matan Torah, Amalek attacked Bnei Yisrael at Refidim. As the leader of the Jewish people, one would expect Moshe to lead the battle against Amalek. Yet, Moshe tells Yehoshua, who is mentioned for the first time in the Torah, to select an army and lead Bnei Yisrael in battle. However, why does Yehoshua lead the fighting instead of Moshe?
The Ramban says that Moshe did not fight in this battle because he needed to be on top of the hill where he could oversee the battle and pray for Bnai Yisroel. In addition when Bnei Yisrael would see Moshe praying and they would be inspired and ask Hashem for help. However, later, in Parshat Chukat, Moshe does lead the battles against Sichon and Og himself. Therefore why here does Moshe take a backseat and let Yehoshua lead the battle?
One possible answer is that Moshe did this as an educational experience for both Bnei Yisrael and Yehoshua. Unlike the wars to come, Moshe saw this battle as the ultimate cultural war between good and evil, with Amalek representing pure evil, and with the Torah and Hashem representing good. Moshe wanted to show that by praying to Hashem, good will always triumph over evil. Conversely, when Bnei Yisrael do not follow Hashem’s guidance, they will not succeed and they will be punished. In Parshat Shelach, the Maapilim decided to go into Canaan before Hashem allowed it, and were therefore massacred by Amalek. Here Moshe is showing Bnei Yisrael here that in addition to using their physical weapons, they have to look to Hashem in order to succeed. As a result, Moshe was able to strengthen Bnei Yisrael’s self esteem and confidence in Hashem.
Moshe appointed Yehoshua to lead Bnei Yisrael, not because of his own weakness, fear, or old age, but rather because of the need to train Yehoshua in the conduct of war. Through prayer and confidence in Hashem, Bnei Yisrael will succeed. These are skills that will be required when Yehoshua leads Bnei Yisrael final into Eretz Yisrael and they conquer the land. The victory in this battle also heightened Yehoshua’s self esteem, which would aid him in his future leadership of Bnei Yisrael.