Accountability is determined by the exercise their own free will and understanding of what they are doing. So for example a 4 year old child hitting another child or stealing is wrong but does the child fully understand yet- the implications of their actions. Are they held accountable in the eyes of Allah swt- the answer is no. This is also because their aql and rational/intellectual faculty is not yet developed fully.
Hence those suffering with serious mental illness in which their aql is severely affected such as severe bi-polar or severe mood disorders, or forms of schizophrenia my have entire breaks from reality, they may for example even think "they are the president of the United States" and actually believe it. These are cases in which such a person is not rational whatsoever and hence would most likely not be held accountable by Allah. Otherwise we are expected to control ourselves and not attribute excuses to simply being "crimes of passion" whereas we are expected to control our passions/impulses and not be controlled by them as human beings that is what distinguishes us from other creatures on this Earth.
wa Allahu al-'Alim,
And Allah is all knowing,