In any prosecution for an offense committed by a sexually delinquent person for which may be imposed an alternate sentence to imprisonment for an indeterminate term, the minimum of which is 1 day and the maximum of which is life, the indictment shall charge the offense and may also charge that the defendant was, at the time said offense was committed, a sexually delinquent person. In every such prosecution the people may produce expert testimony and the court shall provide expert testimony for any indigent accused at his request. In the event the accused shall plead guilty to both charges in such indictment, the court in addition to the investigation provided for in section 35 of chapter 8 of this act, and before sentencing the accused, shall conduct an examination of witnesses relative to the sexual delinquency of such person and may call on psychiatric and expert testimony. All testimony taken at such examination shall be taken in open court and a typewritten transcript or copy thereof, certified by the court reporter taking the same, shall be placed in the file of the case in the office of the county clerk. Upon a verdict of guilty to the first charge or to both charges or upon a plea of guilty to the first charge or to both charges the court may impose any punishment provided by law for such offense.
MCL 767.61a