There are, of necessity, limits beyond which legislation cannot rightfully go. This is a worthless and misleading definition.
Mental illness is a myth.
Psychiatrists are not concerned with mental illnesses and their treatments. Suppose that instead of believing in mental illness, people today believed in evil spirit possession and explained weird or unacceptable behavior as the product of evil spirits. Evil spirit possession has no objective reality and exists only in the imaginations of people who believe in evil spirits. Mental illness also has no objective reality and exists only in the imaginations of people who believe in mental illness. If we want to incarcerate people because they seem peculiar to us or because they say things that are not true or that don't make sense, or because we think that despite a past that includes no unlawful activity they might do something bad in the future, then that's what the laws should say - although doing so might raise constitutional questions.