> it doesn't absolve them from knowing right from wrong however
Certain mental conditions absolutely do, in a legal sense. Some conditions onset from brain injury and tumors, some to drug exposure, some are genetic, etc. For those unfortunate few who are afflicted, the most humane outcome is to intervene to keep them away from harming themselves and others, though often they are left unattended to by overstretched mental health services.