No. The English-speaking countries are broadly similar, however.
The UK, for example, recognises mental illnesses such as personality disorders, autistic spectrum disorders, depression, bi polar disorder, and schizophrenia. Expert advice on the severity of the condition is important, however.
Individuals with severe mental illnesses will typically not be prosecuted, but will rather be conditionally cautioned ("we won't charge you if you promise to be treated") or diverted to a psychiatric treatment facility.
By mere "recognition" of mental illnesses you are suggesting that "one size fits all", in such a way that "every offence is invariably caused by mental illness" - Which is premised on a fallacy, since one cannot presume that "All offences invariably have mental illnesses as the underlying cause" (Regardless of the accused being diagnosed with such a condition).
Therefore, it's wrong to make the connection in every case, whenever the offence has been committed; since we cannot presume that every offence is caused by mental illness - Notwithstanding, the accused has been diagnosed with such illness.
Presumably, you seem to think it would be far better for the accused to opt for treatment - By playing stupid, and thereby complicit with so called "experts", in order to fabricate a
false report (alibi), which is based on so called "mental illness" as the purported, underlying, root cause (of the offence) - Simply to avoid a harsher sentence and criminal conviction?
Lastly, do we suppose that "the end would somehow justify the means", so it would still be okay for the Probation Service or the Mental Health Team to tell a "white lie", simply to elicit cooperation by the accused?
Is telling lies one of the tools of the trade (Presupposing that you have
insider knowledge about such organizations)?