
478 So.2d 110 (1985)
Cedric Bernard DANIELS, Petitioner/Appellant,
v.
Honorable Gilbert A. SMITH, Circuit Judge of the Twelfth Judicial Circuit, Respondent/Appellee.
No. 85-1967.
District Court of Appeal of Florida, Second District.
November 8, 1985.
RYDER, Chief Judge.
Cedric Daniels appeals the summary denial of his motion for post-conviction relief. We reverse.
In 1981, Daniels entered a plea of guilty to a number of criminal charges. Three of the offenses involved the use of a firearm, necessitating the imposition of three-year mandatory minimum sentences pursuant to section 775.087(2), Florida Statutes (1981). Daniels received a total sentence of ten years, with the three-year minimum sentences running consecutively. In his motion to vacate or correct sentence, Daniels claimed that this "stacking" of minimum mandatories was improper under Palmer v. State, 438 So.2d 1 (Fla. 1983).
We have previously held that Palmer may be applied retroactively. Cisnero v. State, 458 So.2d 377 (Fla. 2d DCA 1984). See also Moore v. State, 464 So.2d 1296 (Fla. 1st DCA 1985). The trial court, denying Daniels' motion, attached a copy of the plea colloquy. From a review of this transcript, it appears that the offenses in question could have arisen from a single transaction, as that term is employed in Palmer. If so, Daniels has presented a prima facie showing of entitlement to relief.
Upon remand, assuming that the trial court's findings confirm that the charges arose from a single transaction, the question will not be whether Daniels is entitled to relief so much as what relief he should receive. Daniels' sentence was the result of a plea agreement that took into consideration the likelihood of consecutive mandatory minimum sentences. Additionally, a fourth felony charge appears to have been dropped to a misdemeanor while in another unrelated case, a charge of robbery with a firearm was reduced to robbery with a deadly weapon. Neither the state nor the defense (nor the trial judge, in approving the plea bargain) can be faulted for not anticipating the decision in Palmer.
*111 Daniels has asked that the consecutive mandatory minimum sentences simply be set aside. We decline to recommend this disposition without affording the prosecution an opportunity to be heard. When a plea bargain to an illegal sentence is entered, with all parties mistakenly believing the sentence is legal, the proper remedy is to permit the defendant to withdraw the plea if he so desires. Forbert v. State, 437 So.2d 1079 (Fla. 1983). Britt v. State, 352 So.2d 148 (Fla. 2d DCA 1977). The state may exercise the option of adopting the same plea bargain with the illegality corrected, but it is not absolutely required to do so. Forbert; Cleveland v. State, 394 So.2d 230 (Fla. 5th DCA 1981).
We remand this case to the trial court with directions to determine whether the three-year mandatory minimum sentences do, in fact, stem from a single transaction. If the trial court concludes that they do not, and again denies the motion for post-conviction relief, Daniels must file a notice of appeal within thirty days to obtain further appellate review.[1] If, on the other hand, the trial court agrees that a single transaction is involved, Daniels should be afforded the opportunity to withdraw his plea or, if the state is agreeable, the court may simply direct that the minimum mandatories shall run concurrently.
Reversed.
OTT and LEHAN, JJ., concur.
NOTES
[1]  A denial of Daniels' motion should be substantiated either by a hearing or the attachment of sufficient record excerpts.
