Suppose you have an epileptic fit on a cruise ship and knock a child overboard. You are not culpable for the child's death because it was the epilepsy that caused this tragedy.
Suppose a man with dementia does not recognize his daughter cutting meat in the kitchen and stabs her to death thinking she is an armed intruder. He is not culpable for this tragedy because the dementia caused this tragedy.
Suppose someone has a religious delusion that God has commanded him to cut throat. He is not culpable for the cut throat because it was the delusion that caused this tragedy. When the delusion is gone, he is no more dangerous than you without epilepsy on a cruise ship. He needs to be institutionalized until he is cured of violent delusions.
This is my understanding of how things work in Canada. I will link again the summary of prominent Canadian legal cases from my previous post #50:
https://globalnews.ca/news/2718174/list-canadas-prominent-not-criminally-responsible-ncr-cases/