@Maud Dib,
Ah Just War theory, the justification for the war has to be first broken down. Jus Ad Bellum, Jus In Bello, and Just Post Bellum are in this idea are the parts that determine a just war.
Jus Ad Bellum, or the formulation of starting a war, is determined by these criteria: just cause, comparative justice (as there is injustice on both sides and to override the presumption against the use of force, the injustice on one side must be greater than the other), legitimate authorities have waged it, right intention, success probaility, last resort (when diplomacy fails in other words), and macro-proportionality (anticipated benefits outweigh the expected evils or harms).
Jus In Bello, or the method of which the combatants ought to act, is determined by these criteria: distinction (only attack the enemy soldiers), proportionality (all operations and missions ought to contain minimum collateral harm to civillians), and military necessity, a.k.a. minimum force (no unnecessary, excessive destruction).
Jus Post Bellum, or ending a war, is the most recently made category and is determined according to these criteria: vindication for termination, right intention, legitimate declaration, discrimination (war crime indictment and prosecution by victor), and proportionality of original reason used to justify the war and the terms of surrender.
Well, so the justification is fairly difficult to attain, but this is the current formula for the determination.
For my opinion, as long as the war is in defense of a nation's security or rights, revolution, or proactive attack for the earlier reasons; then, the killing of enemy soldiers are fine.