I would say...in times of war, you are justified in doing whatever is absolutely
necessary and proper to DEFEND yourself, with the express intention
of defending yourself.
A worthy philosophy of war is, As The Philosopher Said:
So long as men desire to live together, no man may initiate--do you hear me? No man may start--the use of physical force against others.
...It is only as retaliation that force may be used and only against the man [or nation, or alliance, or whatever] who starts its use.
No, I do not share [the agressor's] evil or sink to his concept of morality: I mearly grant him his choice, destruction, the only destruction he had the right to choose: his own.
He uses force to seize a value [to wit: to assimilate]; I use it to destroy destruction. A holdup man seeks to gain wealth by killing me; I do not grow richer by killing a holdup man. I seek no values by means of evil, nor do I surrender my values to evil.
So, then, all
options must be kept on the table, for the purpose of defense--but make absolutely sure, before using such an extreme measure as, for example, "genocide" (i.e., the extermination of an entire race)--make absolutely sure
that there is no other way to defend yourself.
Case in point: "The Man Trap". Kirk and Co. were completely justified in killing the salt creature, as it had proven that it was strong enough to overpower Starfleet's finest. The only way to stop this threat was to kill the creature--the last of its kind.