The immunity of noncombatants is not an independent moral rule but rather a part of a convention that sets up a morally desirable alternative to war. Conventions generate special moral obligations that cannot be satisfactorily explained without reference to the convention.
The traditional theory of the just war comprises two sets of principles: jus\; ad\; bellum (governing the resort to war) and jus\; in\; bello (governing the conduct of war). These principles are logically independent, meaning a just war can be fought unjustly and vice versa.
According to traditional theory, individuals are initially morally immune to attack unless they pose a threat, such as combatants in war. Those who pose a threat lose their immunity and become liable to attack. However, not all defensive force is permissible as demonstrated by cases where an initial unprovoked attack does not then give the attacker the right to self-defense against the victim's justified counter-attack.
Unjust combatants may be excused, but not justified, for fighting and therefore do wrong to fight, even if they respect the rules of engagement.
Participation in institutions like the legal system and the military can lead individuals to become instruments of injustice. However, if the institutions are sufficiently important, individuals may be morally obligated to participate, even if it means doing what they believe to be wrong.
Whether people fighting in a war have a just cause makes a significant difference to whether their acts of war can satisfy the jus\; in\; bello requirement of proportionality. In the absence of a just cause, there are no goods to weigh against the harms caused by unjust combatants.
The traditional theory's requirement of discrimination assumes that legitimate targets are combatants, while noncombatants are not. This requirement of discrimination, however, does not hold because it is not permissible for unjust combatants to attack just combatants, except to prevent just combatants from engaging in wrongdoing that makes them morally liable to attack.