Principle of double effect
In the principle of double effect, it is okay to foresee a bad effect but not to intend it.  This means a person who knows their action will cause something bad might still be acting within the principle of double effect, but a person who wants the bad effect definitely is not.