The story of Joshua has long confounded many Christians because of the violence. In Joshua 5:13-15, Joshua confronts an unknown soldier with drawn sword:

15 “And it came to pass, when Joshua was by Jericho, that he lifted up his eyes and looked, and, behold, there stood a man over against him with his sword drawn in his hand: and Joshua went unto him, and said unto him, Art thou for us, or for our adversaries?

14 And he said, Nay; but as captain of the host of the LORD am I now come.

New American Standard Bible (La Habra, CA: The Lockman Foundation, 2020)