
    648 P.2d 145
    The STATE of Arizona, Appellee, v. Joe Louis HARRIS, Appellant.
    Nos. 2 CA-CR 2568, 2 CA-CR 2569-2, 2 CA-CR 2570-3 and 2 CA-CR 2571-4.
    Court of Appeals of Arizona, Division 2.
    June 9, 1982.
    Robert K. Corbin, Atty. Gen. by Bruce M. Ferg, Asst. Atty. Gen., Tucson, for appellee.
    Louie Carrasco, Tucson, for appellant.
   OPINION

BIRDSALL, Judge.

The only question raised in this appeal concerns the sentence of 22 years for armed robbery, with two prior felony convictions.

Pursuant to a plea agreement, appellant pled guilty to three class one misdemeanors and armed robbery. He admitted the allegation of two prior felony convictions. Other charges and the allegations of a dangerous nature were dismissed. The parties agreed that the following sentences would be imposed: time served for the three misdemeanors and 22 years for the armed robbery with priors. As to the latter sentence, the plea agreement stated in parentheses “15 years flat.”

Appellant challenges the legality of the 22-year sentence and the court’s failure to include a provision that he serve no more than 15 years, as provided in the plea agreement.

The attack on the 22-year term is without merit. Armed robbery, a class two felony, requires imprisonment for seven years for a first offense. A.R.S. § 13-701(B). Since appellant admitted two prior convictions, the maximum lawful sentence was 28 years. A.R.S. § 13-604(D). The agreed-upon sentence was therefore lawful.

The transcript of the change of plea hearing supports appellant’s contention that the parties had agreed that he was to be imprisoned for no more than 15 years. In other words, the Department of Corrections, to whose custody he would be committed, was to be ordered to release him regardless of whether the department thought he qualified for release. This the sentencing court could not do.

The legislature has defined the penal discipline for proscribed conduct and has distributed the authority to control the sentence so that the court, the department of corrections and the parole board each serves its purpose, and within its specified sphere of competence, individualizes the sentence. State v. O’Donnal, 110 Ariz. 552, 521 P.2d 984 (1974). Courts have power to impose sentences only as authorized by statute and within the limits set down by the legislature. Whether or not a prisoner is eligible for release on parole or absolute discharge is not for courts to decide — it is within the control of the board of pardons and paroles, A.R.S. § 31-402, or the department of corrections. See A.R.S. §§ 41 — 1604.06 and 1604.07. The court could not place an outer limit on appellant’s release, but could only sentence him to a definite term of years in prison.

Since it appears that appellant’s guilty plea was based on the mistaken belief that he would be released no later than 15 years from the date his sentence commenced, he should be afforded an opportunity to withdraw his guilty plea.

We affirm the sentence of 22 years with directions to the trial court to permit appellant, if he so desires, to withdraw his guilty plea.

HOWARD, C. J., and HATHAWAY, J., concur.  