Mentally ill man detained over killing