The principle of double effect was first described by Thomas Aquinas over 700 years ago. It says that it is sometimes alright to do a bad thing if something good happens, and if a bad ending was not wanted. Aquinas used the example of self defense: sometimes a person will kill someone who attacks them, but killing was not what the person was trying to do. They only wanted to protect themselves. So even though killing someone is bad, wanting to protect themselves was not.