It's still immoral. There is no reason why my life is more valuable than his. If he, however, threatened to kill 5 children if I didn't kill him, then I would. The context is very important, not so much the intent.
For example, I killed a man that was about to blow up a shopping mall. I did...