God gave the fifth commandment, you shall not murder, because He loves your neighbor too. He wants to see us all taken care of. Sin breaks stuff. He gives the 5th commandment to see us protected. In the same attempt to protect us, He also gives authority to government to limit the damage that sin does. He calls them to protect their citizens, even by force. Killing is always painful, but inside of this vocation, God exempts them from the 5th commandment. Soldiers don't fight for selfish gain, but to protect and serve. This is painful, but this is not murder.