If a public employee acts under the apparent authority of a law that is unconstitutional, invalid or inapplicable, he is not liable for an injury caused thereby except to the extent that he would have been liable had the law been constitutional, valid and applicable.
N.J.S. § 59:3-4