It happened, 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 to him, and said to him, Are you for us, or for our adversaries?
The Sovereign, the General, the Captain, the Prince of the armies of Jehovah appeared here with a drawn sword.  What does this mean?  It means that the war Joshua was then engaged in was NOT Joshua's war, it was GOD's war!  The Almighty God, completely disgusted at last with the unprecedented wickedness of the peoples of Canaan, was at that moment determined to destroy them.  God, long before, had reached a similar decision with the antediluvian world, and the Great Deluge took them all away (except for Noah and his family).  The extermination of these peoples in Canaan by the hand of the Israelites was no less merciful than the destruction in the flood.  No problem arises from its being, in fact, different.  The mercy in both instances lay in the truth that it was no longer possible for the love and honor of God to survive in the rotting cultures that were destroyed.