In any criminal proceeding or in any investigation or proceeding before a grand jury in connection with any criminal offense, if a person has advised the prosecuting attorney that he will refuse to answer a question or produce evidence, if called as a witness, on the ground that he may be incriminated thereby, the person may agree in writing with the prosecuting attorney of the county to testify voluntarily pursuant to this section. Upon written request of such prosecuting attorney being made to the district court in and for that county, said district court shall approve such written agreement, unless the court finds that to do so would be clearly contrary to the public interest. If after court approval of such agreement, and if, but for this section, the person would have been privileged to withhold the answer given or the evidence produced by him, the answer given, or evidence produced, and any information directly or indirectly derived from the answer or evidence, may not be used against the person in any manner in a criminal case but the person may, nevertheless, be prosecuted or subjected to penalty or forfeiture for any perjury, false swearing or contempt committed in answering or in producing evidence in accordance with such agreement. If such person fails to give any answer or to produce any evidence in accordance with such agreement, that person shall be prosecuted or subjected to penalty or forfeiture in the same manner and to the same extent as he would be prosecuted or subjected to penalty or forfeiture but for this section: provided, that if such person fails to give any answer or to produce any evidence in accordance with such agreement, the prosecuting attorney may request the district court to compel the person to answer or produce evidence, in accordance with section 19-1115, Idaho Code.
Idaho Code § 19-1114