Mental health problems are common in villains. They must be considered carefully as this can reduce how villainous a person is. However it doesn't automatically follow that a mental illness means a person isn't responsible for their actions, far from it! Around one person in every three develops a mental illness. Around 1 person in every 50 develops schizophrenia, for example. It would be grossly unfair to suggest they can't control themselves.

You have to consider the evidence carefully here. The sentence is especially helpful. If a person got sent to a mental hospital or allowed to go free it can be seen the court felt the mental ill health is such that the illness takes the real blame for the crime. If a person was flung in prison for decades, probably this is a villain. Be careful to compare the sentence to similar cases in the same location! As different places take different approaches.

Anybody acquitted on the grounds of insanity is automatically exempt.