The principle of double effect is a set of ethical criteria for evaluating the permissibility of acting when one’s otherwise legitimate act (for example, relieving a terminally ill patient’s pain) will also cause an effect one would normally be obliged to avoid (for example, the patient’s death.)
The act itself must be good
The bad effect cannot be the means to good
You must have a good intention. The bad bit must be a side-effect.
Total good must be greater than total bad.