When you make an affirmative defense, you are essentially saying that “if what the plaintiff (here, the state) says is true, I am less/not responsible than I would otherwise be due to some permitted mitigating factor”
Thus, the idea of self defense or insanity means that even if the prosecution proves every element of their case, the defendant is trying to prove that there is a factor that absolves them of responsibility. The state must then prove, as a final facet of their case, that the defendant’s assertion of action in self defense or lack of sound mind is not true.
I don’t know how NJ treats this, formally. However, I did uncover the jury instructions for NJ and they contain a third standard that my state does not have:
The burden of proof is upon the State to prove beyond a reasonable doubt that the defendant knew he/she could have retreated with complete safety. If the State carries its burden then you must disallow the defense. If the State does not satisfy this burden and you do have a reasonable doubt, then it must be resolved in favor of the defendant and you must allow the claim of self defense and acquit the defendant.