delivered the opinion of the court:
Defendant pled guilty to the offense of rape in the Circuit Court of Marion County pursuant to a negotiated plea, whereby all other charges pending against him were dismissed. He was sentenced to a term of not less than 3 and not more than 12 years in the Illinois State Penitentiary.
The defendant argues that his conviction should be reversed because the trial court failed to comply with the provisions of Supreme Court Rule 402 governing acceptance of pleas of guilty. We need not, however, discuss this contention because defendant in this case has not received a sentence prescribed by law for conviction of the offense of rape.
The plea agreement proposed to the trial court provided that defen*204dant would enter a guilty plea to the count of the indictment charging him with rape. In return, the State would recommend dismissal of all other charges pending against defendant and recommended a sentence of not less than 3 years and not more than 12 years. After discussing the plea agreement with the defendant, the court accepted the plea and imposed the agreed upon sentence. This was error. The minimum term for rape is 4 years. Ill. Rev. Stat., ch. 38, par. 11 — 1(c).
The trial court lacked the authority to impose a sentence less than the statutory minimum for a conviction of rape. While a trial court has great discretion regarding the imposition of sentence, that discretion must be exercised within the minimum and maximum limits fixed by the legislature. (People v. Richeson, 24 Ill.2d 182, 181 N.E.2d 170; People v. Hart, 132 Ill.App.2d 558, 270 N.E.2d 102.) The trial court has authority under Supreme Court Rule 402(d) to approve a plea bargain voluntarily entered into between the defendant and the state. However, this presupposes that the agreement is one that the court has power to approve. Since the plea agreement in this case called for a minimum sentence of less than 4 years, the court had no power to approve the agreement.
Since the State entered into bargain with the defendant that it could not fulfill, it is necessary to set aside the agreement although it was approved by the trial court.
For the foregoing reasons the judgment of the trial court is reversed and this case is remanded to the circuit court of Marion County for proceedings consistent with' this opinion.
Reversed and remanded with directions.
CARTER and EBERSPACHER, JJ., concur.