(A) A person's ignorance or mistake as to a matter of either fact or law, except as provided in § 130.04 (C), is a defense if it negatives the existence of the mental state which the section prescribes with respect to an element of the offense.
(B) A person's reasonable belief that his conduct does not constitute an offense is a defense if:
(1) The offense is defined by an administrative regulation or order which is not known to him and has not been published or otherwise made reasonably available to him, and he could not have acquired such knowledge by the exercise of due diligence pursuant to facts known to him; or
(2) He acts in reliance upon a section which later is determined to be invalid; or
(3) He acts in reliance upon an order or opinion of an Illinois Appellate or Supreme Court, or a United States appellate court later overruled or reversed; or
(4) He acts in reliance upon an official interpretation of the section, regulation, or order defining the offense, made by a public officer or agency legally authorized to interpret such section.
(C) Although a person's ignorance or mistake of fact or law, or reasonable belief, described in this section is a defense to the offense charged, he may be convicted of an included offense of which he would be guilty if the fact or law were as he believed it to be.
(D) A defense based upon this section is an affirmative defense.
(ILCS Ch. 720, Act 5, § 4-8)