non compos mentis
adjective [ after verb ] uk/ˌnɒn ˌkɒm.pəs ˈmen.tɪs/ us/ˌnɑːn ˌkɑːm.poʊs ˈmen.tɪs/
神志不清的;(尤指)精神失常的,不能为行为负责的
Someone who is non compos mentis is unable to think clearly, especially because of mental illness, and therefore not responsible for their actions.