God has given authority to governments to use the sword according to their discretion:
Romans 13:1 Let every soul be subject unto the higher powers. For there is no power but of God: the powers that be are ordained of God.
2 Whosoever therefore resisteth the power, resisteth the ordinance of God: and they that resist shall receive to themselves damnation.
3 For rulers are not a terror to good works, but to the evil. Wilt thou then not be afraid of the power? do that which is good, and thou shalt have praise of the same:
4 For he is the minister of God to thee for good. But if thou do that which is evil, be afraid; for he beareth not the sword in vain: for he is the minister of God, a revenger to execute wrath upon him that doeth evil.
You'll notice that the above quote is found in the book of Romans, which is a New Testament book. And yet speaks of the one representing the government as being a "REVENGER TO EXECUTE WRATH UPON HIM THAT DOETH EVIL." There's no doubt that God has given the government authority to maintain order in its society through the use of the sword (a weapon used to kill). And if necessary they have been granted full permission to exercise that authority upon individuals doing evil (i.e. breaking the law). The executor of wrath may be a judge. Or it may be a police officer or federal agent granted authority by the government to use lethal force.
Now if God grants the government authority to use the sword within upon its own citizens, for their own safety, it would seem obvious that He would grant them (the government) the same authority to defend themselves in warfare against outward enemies. Basically soldiers perform the same role as police officers. The only difference is that one protects internally, while the other protects externally.