I'm going to make a simpler sentence that has the same structure, in order to make it easier to explain:
I had trouble finding such cake as would satisfy all my fussy relatives.
Here, such cake is the direct object of finding. Or, to be more correct, the whole phrase such cake as would satisfy all my fussy relatives is the direct object of finding.
If we break that second phrase ("such cake as would satisfy all my fussy relatives") down further, we can see that such cake is the subject of satisfy and my fussy relatives is the direct object of it.
In terms of meaning, the above sentence means that the writer is having difficulty finding a cake that would satisfy all his or her relatives. The such simply relates the cake to the condition that the cake must fulfil (i.e. satisfying the relatives).
- such embarrassment as completely prevented me leaving the house (= the embarrassment was such that I couldn't leave the house)
- such fear as froze him to the spot (the fear is a fear which fulfils the condition of freezing him to the spot)
- such quantities of food as made us all sick later (the quantity of food was such a quantity ("large quantity" is implied from context) that we all felt ill later)
Now if we do the same thing with the more complicated sentence we can see that it is his abnormality of mind that is impairing his mental responsibility for his acts. In other words, the abnormality of mind fulfils the condition of substantially impairing his sense of mental responsibility for his acts. And, under that condition (having such an abnormality of mind), the perpetrator would not be convicted of murder - basically, because they didn't know what they were doing was wrong. However, if he didn't fulfil that condition, he could still be convicted of murder.