of unsound mind
Having impaired or dysfunctional thought, memory, and/or cognitive understanding; unable to think and/or understand for oneself. My poor grandfather has been of unsound mind ever since he suffered that stroke last year.
of ˌunsound ˈmind
(law) not responsible for your actions because of a mental illness or condition: He escaped a prison sentence by reason of unsound mind at the time the crime was committed.