Deuteronomy 23:9

When the host goeth forth against thine enemies, then keep thee from every wicked thing.

When the host goeth forth against thine enemies,.... An army of soldiers march in order to meet the enemy and fight him:

then keep thee from every wicked thing; the Targum of Jonathan adds, by way of explanation,

"from strange worship, uncovering of nakedness, and from shedding innocent blood;''

that is, from idolatry, uncleanness of every sort, and murder; and all other wickednesses ought to be abstained from at all times by all persons, but especially by soldiers in such a circumstance, just going to battle; since sin committed weakens natural courage, as it loads the conscience with guilt; and since victory and success, which depend upon the blessing of God on arms, cannot be reasonably expected, where vices of all sorts are indulged and abound; and especially seeing such are about to expose their lives to the utmost danger, and know not but that in a few hours they must exchange this life for another, and appear before God, the Judge of all, against whom they sin; and yet how little are these things thought of by such in common! it was the wisdom of the Jewish legislature, which was of God, to inculcate such things into the minds of their soldiers.