The "Commander of the Lord's Army" shows up in this chapter with an important reframing of the narrative.
Joshua has already been described as a warrior, and asks whether the stranger is friend or foe. The response famously is "no", with an implied reminder that God's side might not be as simple as our human allies or enemies. This passage is only brief, but resonates with other parts of the Old Testament that speak somewhat against any trivial reading of the conquest of Jericho and other lands.