Your reasoning doesn't necessarily apply only to mental diseases. In general, if you are mistaken in fact, that may acquit you from criminal responsibility. F.e. you buy a car but you don't know it's stolen. Your intention was not to to trade illegally. You were deceived. You were convinced that what you do is legal, and you had no reason to think otherwise. The documents were forged, etc...whatever you can imagine.
In your example, the intention of the insane person was not to murder humans. Killing invading aliens is not murder. Same way, if I hear strange noises in the house and I think it's burglars, and I hit the person in the dark and he/she might actually die of the hit: and it turns out it was my son sneaking in after coming home from a party I was not aware he went to: then I was mistaken in the person and I thought I was defending my home and I had every reason to be afraid coz few weeks ago a neighbor was burgled...
The point is, even sane persons can be mistaken about their deeds.
Now you might accuse me of missing your point that just like sane persons can be mistaken, insane people can also be able to plan and rationalize: well as you see I didn't miss the point

Now of course anyone could just say that 'oh I didn't kill my wife coz I hated her but coz I thought she is a burglar': well you actually can say that. You have the presumption of innocence, and the court has to prove that you had no reason to think otherwise. Take the Pistorious case. He said he killed his gf coz he thought it's burglars. So it's actually a real case. Another question is that he was proven guilty.
There are extreme cases possible, f.e in that movie with Sharon Stone I think when she had this...illness when you drink even a drop of alcohol, you become intoxicated (I'm lazy to look up the formal name), and in that state you are not responsible for your actions. Note that it is not the same as getting drunk. Being drunk is not an excuse. But that illness is. So she planned that somehow she'd get into that state and she knew she'd kill her victim then, but she could plead not guilty. But she was busted somehow. The point is, someone may actually rationally plan to get into a state of mind when she/he loses his/her mind (and again, this is not the same as getting drugged/drunk). Ok, I digress , I just thought it's interesting.
But back to the point, I was rather asking cases when someone suffers from such a mental disease that he/she is not responsible legally at all. F.e retarded people. I mean, officially retarded people, who were born like that...Sorry, English is not my first language and I don't know all the official legal and medic terms...But you get my point. At least, in our penal code, certain people are simply not liable: children, retarded people,etc.
So my question was rather about these cases...Of course I can also think of certain mental disorders when the person didn't lose all his/her ability to plan/rationalize. But when someone is born retarded, or an old person with dementia, who lost the ability to rationally think about the consequences of killing a human: in their case, I don't know if we can say that the step distinguishing them from those who do not actually act upon homicidal thoughts: is determination. And even in your case, the determination is not to kill humans. Your person is determined to kill aliens. So, my point is (and I may be wrong) that to say that someone is determined, the person must have the mental ability to measure the consequences at least. If one doesn't even know what his action may result in: how can we say that he was determined to achieve that result? (Thus your case is different as the person could see the consequences -if you shoot a being, it dies- he was just mistaken about his targets' identity, but if he knew they were not aliens but humans, he probably wouldn't have killed them).But just because someone can plan, it still doesn't necessarily mean that his determination was to murder, even if that's the result. Sane or insane that person may be.