
976 So.2d 695 (2008)
Johnnie CRUZ, Appellant,
v.
STATE of Florida, Appellee.
No. 4D07-1484.
District Court of Appeal of Florida, Fourth District.
March 24, 2008.
Carey Haughwout, Public Defender, and Paul E. Petillo, Assistant Public Defender, West Palm Beach, for appellant.
*696 Bill McCollum, Attorney General, Tallahassee, and Jeanine M. Germanowicz, Assistant Attorney General, West Palm Beach, for appellee.
PER CURIAM.
Johnnie Cruz appeals a final order denying his rule 3.850 motion for postconviction relief after an evidentiary hearing. While the appeal was pending in this court, instead of filing a reply brief, defense counsel filed an emergency petition for writ of habeas corpus, arguing that Cruz is now entitled to immediate release. We reverse the order denying postconviction relief, transfer the habeas petition to the circuit court, and direct the trial court on remand to consider it expeditiously in light of Cruz's apparent entitlement to immediate release from custody.
On September 6, 2001, the trial court sentenced Cruz to ten years as a habitual felony offender for burglary and grand theft. The trial court suspended all but four years of the sentence and the remainder was to be served on probation. As Cruz explains, this was a "true split sentence." Gibson v. Fla. Dep't of Corr., 885 So.2d 376, 381 (Fla.2004).
After serving his prison term, Cruz claims to have been released on or about July 2, 2005, to begin serving his probation. He was arrested for a technical violation on or about September 30, 2005, and the record indicates that on January 30, 2006, pursuant to a negotiated plea, the court sentenced Cruz to six years for each count, concurrently, with credit for all time served. The written sentence awarded him 121 days of jail credit for time incarcerated prior to the imposition of sentence. This appeal concerns Cruz's prison credit. With respect to each count, the trial court checked the prison credit box on the sentence form, which provides, "It is further ordered that the defendant be allowed credit for all time previously served on this count in the Department of Corrections prior to resentencing."
It is clear from the transcript of the plea and sentencing hearing that the state and the trial court agreed Cruz would receive credit against the six-year sentence for every day he had already spent in custody on this case. The trial court specifically stated: "My understanding [is] that you will get credit for every single day you have actually been in a facility, either county or state facility." The sentencing judge calculated the jail time credit, but announced he was leaving the precise calculation of prison time credit to the Department of Corrections.
However, on Cruz's arrival in prison, he was informed that, because he was now serving the six years of his previously suspended sentence, and because he had never previously served any of that time, he was not entitled to receive any credit for the approximately four years he had previously served on the non-suspended portion of his sentence. In the course of exhausting his administrative remedies, Cruz was advised to seek relief from the sentencing court.
Cruz filed a motion for postconviction relief, claiming defense counsel was ineffective for misadvising him as to the amount of time he would serve as a result of his plea  i.e., that he would receive credit against the six-year sentence for the time he spent in prison before beginning his probation  and he wished to withdraw his plea. In a separate ground, he sought judicial enforcement of his negotiated plea agreement. Following an evidentiary hearing, in which the state argued that counsel did not promise Cruz that the department would credit him with any specific number of days for time previously served, the trial court denied the motion.
*697 On appeal, the state argues that Cruz received the sentence he bargained for: six years in prison, less the credit for any time he might have served. To the extent the department may have erred in refusing to give him credit for his prison time served, his proper remedy was a petition for writ of mandamus challenging the department's denial of his administrative grievances.
However, it appears that the department correctly interpreted the sentencing documents which it received. See Moore v. Stephens, 804 So.2d 575 (Fla. 5th DCA) (reversing order granting mandamus petition seeking credit for time previously served, where defendant was sentenced following revocation of probation on true split sentence; after imposition of suspended portion of sentence, credit was not available for time served on unsuspended portion of split sentence), cause dismissed, 817 So.2d 850 (Fla.2002); Roberts v. State, 702 So.2d 239 (Fla. 2d DCA 1997) (affirming order denying motion for postconviction relief, seeking additional credit; where defendant received true split sentence of five years in prison followed by ten years of probation, he was not entitled to credit, against ten-year sentence imposed following probation violation, for time served or gain time awarded in connection with the five-year sentence).
According to Cruz, in order to effectuate the plea agreement, the trial court should have determined how much time he had served and should have sentenced him to a term equal to six years less that amount, instead of sentencing him to six years less credit for time served. But at sentencing, neither the parties nor the court apparently realized the impact which the law, as explained in opinions like Stephens and Roberts, would have on the calculation of his prison credit  effectively eliminating it.
Nevertheless, it is clear from the plea and sentencing transcript that all parties contemplated that Cruz would receive credit for the time he actually served on the unsuspended portion of his sentence.[1] When that did not occur, he was entitled either to withdraw from the negotiated plea or to have its terms enforced. See generally Hunt v. State, 613 So.2d 893, 898 (Fla.1992) (providing that when an agreement with the defendant is not fulfilled, the defendant is entitled to its specific performance or to withdrawal of the defendant's guilty plea) (citing Santobello v. New York, 404 U.S. 257, 263, 92 S.Ct. 495, 30 L.Ed.2d 427 (1971)). If Cruz has served the entire agreed-upon sentence, merely allowing him to withdraw from the plea agreement would be inadequate relief; he should be entitled to choose to have the agreement enforced by the trial court's restructuring his sentence to give effect to the negotiated agreement.
This case is similar to Wallace v. State, 793 So.2d 78 (Fla. 2d DCA 2001) (where department forfeited gain-time that the trial court had awarded at sentencing, court treated defendant's certiorari petition as a motion to enforce plea agreement and transferred the matter to sentencing judge to sentence defendant in a manner that would effectuate the intention of the plea agreement and would take into account the department's cancellation of credit, or to allow the defendant to withdraw his plea); and Davis v. Singletary, 659 So.2d 1126 (Fla. 2d DCA 1995) (treating defendant's mandamus petition as a motion to enforce the plea agreement and *698 transferring it to the sentencing judge, to resentence the inmate in a manner that takes into account the effect of the department's cancellation of credit or to allow the inmate to withdraw his plea). Here, Cruz's motion already sought enforcement of his plea. That relief should have been granted here.
Cruz's total sentence was 6 years, or 2190 days. He calculates he actually served 1379 days on his initial 4-year sentence, received 121 days of jail credit in connection with the VOP, and, at the time he served his habeas petition, had served another 769 days. That totals 2268 days, or 78 days more than his sentence. If Cruz's calculations are correct, he has already served more than the full sentence which was contemplated by the negotiated plea agreement, and he is entitled to immediate release. See generally Cross v. Navarro, 585 So.2d 1040 (Fla. 4th DCA 1991); Hut v. State, 519 So.2d 1 (Fla. 3d DCA 1987). If the record so established, this court would grant the petition; however, because it does not, the petition is transferred to the trial court. On remand we direct the trial court to consider it expeditiously in light of Cruz's apparent entitlement to immediate release.
Appeal reversed and remanded with instructions; petition for writ of habeas corpus transferred for expeditious consideration.
SHAHOOD, C.J., STONE and WARNER, JJ., concur.
NOTES
[1]  We also note that Cruz had no incentive to enter a negotiated plea to receive the maximum sentence the trial court could have imposed on revocation of probation. Clearly, the state was offering him a considerably lower sentence of only approximately two more years in prison in exchange for his admission to the technical violation.
