Substitute "guilty by reason of insanity" and we'll talk.
They cut open their kids to pull out all the snakes that are inside them because they want to save them.
They munch on the delicious Turkey leg and have no idea they are actually chewing on someone's arm.
They are insane, bonkers, not in their right mind. It is not just to try to punish them because they can not learn anything from the punishment. But they are dangerous and need to be kept locked away from people because of that reason.
Not guilty by reason of insanity means that they can declare that you are fine and let you go. Guilty but insane means that you stay locked up.