No person may be compelled to be a witness against himself or herself in a criminal action. Notwithstanding any provision of law to the contrary, in any criminal proceedings before a court or grand jury or state's attorney's inquiry, if a person refuses to answer a question or produce evidence of any kind on the ground that the person may be incriminated thereby, and if the prosecuting attorney, in writing and with approval of the attorney general, requests the court to order that person to answer the question or produce the evidence, the court after notice to the witness and hearing may so order, and that person shall comply with the order. In the case of a state's attorney's inquiry, such application must be made to the district court. No testimony or other information compelled under the order, or any information directly or indirectly derived from the testimony, may be used against the witness in any criminal proceeding, except a prosecution for perjury, giving a false statement, or contempt committed in answering, or failing to answer, or in producing, or failing to produce, evidence in accordance with the order.
N.D.C.C. § 31-01-09