NYSentencing

§ 35.05  Justification; generally.
    Unless  otherwise  limited  by the ensuing provisions of this
article defining justifiable use of physical force, conduct which
would  otherwise  constitute  an  offense  is justifiable and not
criminal when:
    1.   Such  conduct  is  required or authorized by law or by a
judicial decree, or is performed  by  a  public  servant  in  the
reasonable  exercise of his official powers, duties or functions;
or
    2.   Such  conduct  is  necessary  as an emergency measure to
avoid an imminent public or private  injury  which  is  about  to
occur by reason of a situation occasioned or developed through no
fault of the actor, and which is of such gravity that,  according
to   ordinary   standards   of  intelligence  and  morality,  the
desirability and urgency of avoiding such injury clearly outweigh
the desirability of avoiding the injury sought to be prevented by
the statute defining the offense in  issue.   The  necessity  and
justifiability  of  such conduct may not rest upon considerations
pertaining only to the morality and advisability of the  statute,
either  in  its  general  application  or  with  respect  to  its
application to a particular class of  cases  arising  thereunder.
Whenever  evidence relating to the defense of justification under
this subdivision is offered by the  defendant,  the  court  shall
rule   as   a  matter  of  law  whether  the  claimed  facts  and
circumstances would, if established, constitute a defense.