When thou goest forth to war against thine enemies
This refers to an arbitrary war, as Jarchi remarks, which they entered into of themselves, of choice, or through being provoked to it by their enemies; and not a war commanded by the Lord, as that against the seven nations of Canaan, and against Amalek; since there were to be no captives in that war, but all were to be destroyed:
and the Lord thy God hath delivered them into thine hands;
given them the victory over their enemies, so that they were obliged to surrender themselves to them prisoners of war:
and thou hast taken them captive,
or "led his or their captivity F2 captive"; led them captive who used to lead others, denoting their conquest of victorious nations; see a like phrase in ( Psalms 68:18 ) .