In any criminal proceeding before a court or grand jury, if a person refuses to answer a question or produce evidence of any other kind on the ground that he may be incriminated thereby and if the Attorney General or the county prosecutor with the approval of the Attorney General, in writing, requests the court to order that person to answer the question or produce the evidence, the court shall so order and that person shall comply with the order. After complying and if but for this section, he would have been privileged to withhold the answer given or the evidence produced by him, such testimony or evidence, or any information directly or indirectly derived from such testimony or evidence, may not be used against the person in any proceeding or prosecution for a crime or offense concerning which he gave answer or produced evidence under court order. However, he may nevertheless be prosecuted or subjected to penalty or forfeiture for any perjury, false swearing or contempt committed in answering, or failing to answer, or in producing, or failing to produce, evidence in accordance with the order. If a person refuses to testify after being granted immunity from prosecution and after being ordered to testify as aforesaid, he may be adjudged in contempt and committed to the county jail until such time as he purges himself of contempt by testifying as ordered without regard to the expiration of the grand jury; provided, however, that if the grand jury before which he was ordered to testify has been dissolved, he may then purge himself by testifying before the court.
N.J.S. § 2A:81-17.3