To what extent can a mad person be held accountable for his sins? Or is he accountable at all?

To what extent can a mad person be held accountable for his sins? Or is he accountable at all?

It is well known that according to one’s aptness and discerning one is held accountable by God.

Madness is of various degrees and types. There may be a person who is mad with regard to a certain subject and in other cases he behaves as if he is completely sane so that those who do not know him will never imagine that he is mad. There is also a kind of madness which is not continuous, of which a person can be cured but returns again. Another kind is sheer madness or absolute madness in which the mind is totally insane. 

A person who is absolutely mad cannot be held accountable for anything at all.

He is not charged for any sin he commits while being mad because he is not aware.
He is only charged for the sins he committed before getting mad, after which time he is considered dead and is not held accountable.

With regard to other kinds of madness he is charged as far as he is discerning and as far as he is able to control his behaviour.

Seeing that the Lord has said about those who crucified Him, “Father, forgive them, for they do not know what they do ” (Luke 23:34), how much rather the mad should be forgiven; for mentally “they do not know what they are doing”.