I just can't imagine NPD providing mitigating circumstances for a crime, whereas with an anxiety disorder, it just seems a bit more 'worthy'.
I think it's how responsible for your own reactions having the disorder makes you.
Anxiety can make you do astonishingly strange things. Apart from the physical results, you can act impulsively, instinctively in ways that you simply can't control (screaming, shaking, hitting yourself or someone/something else). The adrenalin that's flooding you at that moment can make your actions into something you're not quite able to control.
With something like NPD, it can be emotionally very difficult to act in a certain way - for example, for taking the blame for something or admitting a fault. It can feel like a physical pain, a physical block, but the action is without that impulsive action that you might have in panic mode. There is some element of choice - you can either push through the pain and do the hard thing (admitting your own fault) or you can rush to the easier thing of deflecting blame. It feels like an instinct, but it's not quite the same as a compulsion.
I realise that that second paragraph looks as if I'm talking about OP, but I swear that's entirely coincidental. I have no idea whether he has NPD or not, and viewing his actions purely on the stressful situation of the trial.
In fact I was thinking about someone I know who acted in an astonishingly foot-stamping, heartbroken way when they were forced to face the consequences of their own actions. It was strange to watch this grown (elderly) woman fighting utterly desperately to make it not her fault, and the bile that she came out with in a desperate attempt to make the playing field level again. (She got over it - by the following day her brain had simply decided that non of it had happened, and while she got agitated if it was mentioned again, she also closed down entirely and refused to let the subject in.)