He said, No; but [as] prince of the host of Yahweh am I now come. Joshua fell on his face to the earth, and did worship, and said to him, What says my lord to his servant?
The command to remove his sandals (Joshua 5:15) would have convinced Joshua that this was the same God who appeared to Moses at the burning bush (Exodus 3:5).