
792 P.2d 7 (1990)
John Cleveland BENJAMIN, Petitioner and Respondent,
v.
Jack McCORMICK, Warden, Montana State Prison, Respondent and Appellant.
No. 89-182.
Supreme Court of Montana.
Submitted on Briefs March 22, 1990.
Decided May 8, 1990.
*8 Marc Racicot, Atty. Gen., Robert F.W. Smith, Asst. Atty. Gen., Helena, for respondent and appellant.
John S. Forsythe, Forsyth, for petitioner and respondent.
TURNAGE, Chief Justice.
The State of Montana appeals a writ of habeas corpus issued by the Third Judicial District Court, Powell County, ordering the warden of the Montana State Prison to release prisoner John Benjamin on parole. The District Court found that Benjamin did not fully understand the consequences of his guilty plea when the sentencing court, prosecuting attorney, and defense attorney represented that he would be incarcerated approximately one year under the terms of his plea bargain agreement, but the sentence and agreement required completion of a two-year sexual offender program. We affirm.

ISSUES
The State raises three issues:
1. Did the habeas corpus court err in not enforcing the petitioner's plea bargain agreement as written?
2. Did the sentencing court err by representing that the petitioner would be incarcerated for approximately one year when the court had no authority to guarantee probation?
3. Did the habeas corpus court err in finding that the petitioner's plea of guilty was not made voluntarily and knowingly?

FACTS AND PROCEDURE
This case presents an unusual set of circumstances. Under the terms of a plea bargain agreement, John Benjamin pled guilty to deviate sexual conduct in violation of § 45-5-505, MCA, and possession of a dangerous drug in violation of § 45-9-102, MCA. The Sixteenth Judicial District Court sentenced Benjamin to the Montana State Prison for ten years with five years suspended on the first count and for one year on the second count to run concurrently. The sentence included nondangerous offender designation and enrollment in the sexual offenders program.
Prior to accepting the guilty plea, the District Court elicited Benjamin's statement providing factual support for the plea. The court also carefully questioned Benjamin to establish that he voluntarily pled guilty and that he fully understood his rights and the effect of his plea.
At the time of sentencing, the court stated:
And, of course, if you don't know, in Montana, a ten year sentence, five suspended, nondangerous criminal, you will serve, actually serve, somewhere around a year, give or take a few days one way or the other. And the sentence, of course, will recommend a treatment program.
After one year in prison, Benjamin was denied parole and petitioned the sentencing court for a writ of error coram nobis. The court denied the writ holding that it had no *9 jurisdiction to modify the sentence. In its opinion, the court stated:
Defendant entered into a plea bargain agreement which provided, among other things, that the defendant would enroll in a sexual offenders program while serving his sentence in the state prison. It was the belief of the court, defense counsel and the county attorney that the defendant would serve about a year in the prison. At the time of sentencing, the Court did not know that attendance in the sexual offender program in the prison would enhance defendant's sentence by more than a year.
Benjamin then petitioned the court for a writ of habeas corpus on the same grounds, and the court transferred the petition to the court of appropriate jurisdiction.
The Third Judicial District Court, Powell County, granted the petition and ordered Benjamin's release on parole. The court found that Benjamin did not fully understand the consequences of his plea when entered or during sentencing because the sentencing court, the prosecuting attorney, and his defense counsel had all represented that he would serve only one year in prison. Following his release, the State of Washington re-incarcerated Benjamin for violating his parole from a previous sentence for sexual offenses. The State now appeals the habeas corpus court's decision.
We will address two preliminary arguments before reaching the determinative issue in this case.

PLEA BARGAIN ENFORCEMENT
The parties argue for specific enforcement of different terms of the plea bargain agreement. Their contentions, however, fail to consider the current state of the law. In State v. Cavanaugh, this Court overturned a plea bargain sentence when the district court failed to inform the defendant that he would not be eligible for parole. Cavanaugh (1983), 207 Mont. 237, 240, 673 P.2d 482, 484. We held that,
the trial judge, who accepts a plea but rejects any other portion of the plea bargain, [is required] to afford the defendant the opportunity to withdraw his guilty plea and enter a plea of not guilty.
Cavanaugh, 207 Mont. at 243, 673 P.2d at 485.
The 1985 Legislature revised § 46-12-204, MCA, the statute governing plea bargain agreements. Act approved April 23, 1985, ch. 606, § 2, 1985 Mont. Laws 1278, 1279. The statute now clearly delineates the effect of plea bargain agreements.
A plea bargain agreement is an agreement between a defendant and a prosecutor that in exchange for a particular plea the prosecutor will recommend to the court a particular sentence. A judge may not participate in the making of, and is not bound by, a plea bargain agreement. If a judge does not impose a sentence recommended by the prosecutor pursuant to a plea bargain agreement, the judge is not required to allow the defendant to withdraw a plea of guilty.
Section 46-12-204(3)(a), MCA.
Under the present law, the sentencing court was not a party to the bargain and was not subject to its terms. The enforceability of the bargain is, therefore, not an issue.

GRANTING PROBATION
The Attorney General argues that by telling Benjamin that he would be paroled in one year, the sentencing court usurped the authority of the Board of Pardons by guaranteeing probation. The Attorney General overstates his position.
First, a fair reading of the sentencing court's statement in light of the surrounding circumstances does not indicate that the court intended to guarantee Benjamin's parole. The court certainly knew that Benjamin's parole eligibility depended on numerous factors beyond its control. As the sentencing court later stated, it merely intended that the sexual offender program would not extend Benjamin's incarceration beyond the normal one-year incarceration before parole eligibility for a ten-year sentence.
Second, the Board of Pardons does not have exclusive authority to grant parole. *10 Section 46-23-104(1), MCA, only gives the Board statutory authority to establish regulations and grant parole subject to the restrictions set out in § 46-23-201, MCA. When a district court finds for a petitioner on a writ of habeas corpus, it too may order parole under its authority to enter "such supplementary orders as to reassignment, retrial, custody, bail, or discharge as may be necessary and proper." Section 46-22-306, MCA.

VOLUNTARY AND KNOWING PLEA
The primary issue in this case is whether Benjamin voluntarily and knowingly entered his plea of guilty. Before accepting a guilty plea, the sentencing court must determine that the plea is "voluntary with an understanding of the charge," § 46-12-204(2), MCA, and the court must inform the defendant of "the consequences of his plea ...," § 46-16-105(1)(b), MCA. The law does not require the sentencing court to educate the defendant on all aspects of the relevant law before accepting a guilty plea. However, when the guilty plea is based upon a fundamental mistake or misunderstanding as to its consequences, the sentencing court, at its discretion, may allow the defendant to withdraw the plea.
A change of plea will be permitted only if it fairly appears the defendant was ignorant of his rights and the consequences of his act, or he was unduly and improperly influenced either by hope or by fear in making the plea, or if it appears the plea was entered under some mistake or misapprehension. Each case must be examined on its own record. The motion rests within the District Court's discretion and the exercise of that discretion will not be disturbed absent an abuse of discretion.
State v. Mesler (1984), 210 Mont. 92, 96, 682 P.2d 714, 716 (citation deleted).
In this case, Benjamin's guilty plea was based on error. Both the sentencing court and the habeas corpus court found that Benjamin was misinformed as to the consequences of his plea. The record contains sufficient evidence to establish that the sentencing court, prosecutor and defense counsel all apparently failed to recognize that the sexual offender program lasted two years and assured the defendant that he would be incarcerated for only one year.
The usual remedy for a guilty plea that is not voluntarily or knowingly made is to allow the defendant to withdraw the plea. In this case, however, the habeas corpus court exercised its discretion to order Benjamin's release on probation. The court has the discretion to determine whether withdrawal of a guilty plea is appropriate, § 46-16-105(2), MCA, and to issue orders implementing its decision for the petitioner, § 46-22-306, MCA. As the court noted, withdrawal of the plea and further legal proceedings would not have been appropriate in this case. Benjamin never asked the court to withdraw his plea or claimed that he was not guilty. He argued only that he should have been released after one year as the sentencing court intended.
We hold that, on the facts of this particular case, the District Court did not abuse its discretion in releasing Benjamin on parole on the grounds that he did not have an adequate understanding of the consequences of his guilty plea.
Affirmed.
HARRISON, SHEEHY, McDONOUGH and WEBER, JJ., concur.
