
392 So.2d 54 (1981)
Gerald Dean JOLLY, Appellant,
v.
STATE of Florida, Appellee.
No. 80-618.
District Court of Appeal of Florida, Fifth District.
January 7, 1981.
*55 Gerald Dean Jolly, pro se.
No appearance for appellee.
PER CURIAM.
Appellant Gerald Dean Jolly pleaded guilty to shooting into an occupied vehicle[1] and was sentenced to three years imprisonment. Contending that the trial judge incorrectly believed that he was required to impose the three-year minimum sentence for the use of a firearm,[2] appellant filed a motion to correct the sentence pursuant to rule 3.800, Florida Rules of Criminal Procedure.[3] The motion was denied.
Appellant was charged with shooting into an occupied vehicle in violation of section 790.19, Florida Statutes, a second degree felony punishable by a term of imprisonment not exceeding fifteen years.[4] He was also charged with shooting into a *56 dwelling. Appellant pleaded guilty to shooting into an occupied vehicle on the condition that the other count be nol prossed and that the three-year sentence be imposed. The record reflects that the trial judge, the prosecutor and the defense counsel believed that the judge had no discretion to sentence appellant to other than the three-year sentence under the statute.
Shooting into an occupied vehicle, however, is not one of the enumerated offenses for which the three-year minimum sentence must be imposed. Therefore, the trial court did err in accepting a guilty plea conditioned upon the imposition of the minimum sentence pursuant to a statute which was not applicable.
As the negotiations were based on a material mistake of law, the plea was invalid and no legal sentence could be imposed. The remedy, in these circumstances, is not to correct the sentence but to set aside the plea (and the consequent judgment and sentence), and to reinstitute the two charges pending against the defendant prior to the invalid plea. See Fla.R.Crim.P. 3.170(f), 3.171, and 3.172. Thus, appellant should have filed a 3.850 motion to vacate the judgment and sentence and his 3.800 motion to correct was properly denied.
The 3.800 motion as filed does not substantially comply with the requirements of rule 3.850. See Saxon v. State, 384 So.2d 35 (Fla. 5th DCA 1980). Even if we treated the motion as a 3.850 motion, we would set aside the judgment as well as the sentence, not merely remand for resentencing. If the foundation of the sentence is defective, a new sentence cannot correct it. Only a new plea negotiation or a trial can remedy the problem at this point. To let the plea and judgment stand would give the defendant the benefits of his bargain i.e., a three-year sentence cap and dismissal of the other charge-and would deny the state what it bargained for: a mandatory three-year sentence.
The state's negotiation was clearly based upon the premise that the defendant would receive a mandatory three year sentence. If the plea negotiation is not binding upon the defendant, then it is not binding upon the state. The nolle prosequi, entered before jeopardy attached on the charge for shooting into a dwelling, should not operate as an acquittal nor prevent further prosecution if the negotiated plea is not binding. See Bucolo v. Adkins, 424 U.S. 641, 96 S.Ct. 1086, 47 L.Ed.2d 301 (1976).
If the defendant chooses not to be bound by the misconceived bargain, he is entitled to make that decision. Cf. Freeman v. State, 376 So.2d 294 (Fla.2d DCA 1979). But, in that event, the nolle prosequi of the companion case should not stand. See Brown v. State, 367 So.2d 616 (Fla. 1979). The speedy trial period would exclude the period between the acceptance and the withdrawal of the original plea. Wilkinson v. State, 322 So.2d 620 (Fla.3d DCA 1975).
However, due to the fact that a post-conviction motion may be raised and ruled upon years after imposition, the state may no longer have the witnesses and other evidence necessary to pursue a trial after a defendant successfully has his judgment and sentence vacated. Therefore, in a situation involving a reduction of sentence in contravention of the plea bargain, the state should be given the option of either agreeing that both the judgment and sentence should be vacated and taking the defendant to trial on all original charges, or agreeing that only the excessive sentence should be vacated, while having the judgment stand and allowing the defendant to be resentenced in accordance with the principles enunciated in North Carolina v. Pearce, 395 U.S. 711, 89 S.Ct. 2072, 23 L.Ed.2d 656 (1969).
The trial court's denial of appellant's 3.800 motion is affirmed without prejudice to his right to file an appropriate 3.850 motion to vacate the judgment and sentence.
AFFIRMED.
COBB, FRANK D. UPCHURCH, Jr., and SHARP, JJ., concur.
NOTES
[1]  § 790.19, Fla. Stat. (1979).
[2]  Section 775.087(2), Florida Statutes (1979), provides:

(a) Any murder, sexual battery, robbery, burglary, arson, aggravated assault, aggravated battery, kidnapping, escape, breaking and entering with intent to commit a felony, or aircraft piracy, or any attempt to commit the aforementioned crimes; or
(b) Any battery upon a law enforcement officer or firefighter while the officer or firefighter is engaged in the lawful performance of his duties and who had in his possession a `firearm,' as defined in s. 790.001(6), or "destructive device," as defined in s. 790.001(4), shall be sentenced to a minimum term of imprisonment of 3 calendar years. Notwithstanding the provisions of s. 948.01, adjudication of guilt or imposition of sentence shall not be suspended, deferred, or withheld, nor shall the defendant be eligible for parole or statutory gain-time under s. 994.27 or s. 994.29, prior to serving such minimum sentence.
[3]  Rule 3.800 provides for the correction and reduction of sentences.
[4]  § 775.082(3)(c), Fla. Stat. (1979).
