Courts treat plea agreements between prosecutors and defendants like contracts: Each party must live up to its end of the bargain, and failure to do so is a breach. But if the parties haven't finalized the agreement in court, the prosecution might be able to back out of it—depending on what rule or standard the court applies.
For the most part, a prosecutor has the right to withdraw a plea deal as long as it hasn't been officially entered and finalized in court. Some courts, however, have found the prosecution's withdrawal of an offer improper in certain circumstances even before it's finalized.
In most courts across the country, the prosecution usually has until the defendant enters the plea in court and the judge accepts it to back out of the deal. But even where prosecutors are free to back out of not-yet-official plea deals, courts must protect defendants' rights: If the prosecution backs out, it may not be able to use at trial any statements the defendant made during plea negotiations.
Courts in many places consider statements inadmissible if a defendant makes them in reasonable reliance on the possibility of a plea deal. In other words, even if the prosecution and defense have merely discussed a deal that the prosecution doesn't later agree to, statements made by the defendant during plea negotiations may be inadmissible.
The American Bar Association (ABA) created a stricter standard for prosecutors, but most courts don't follow it. In essence, it provided that it's unprofessional for the prosecution to back out of a plea agreement once it offers one to a defendant and the defendant indicates that he accepts it. (The standard has since changed but a few courts still follow its principles.)
Under this minority view, even if the defendant hasn't had the chance to formally take the plea in court, the prosecution can't back out unless:
For example, the prosecution would be able to back out under this standard if the defendant skipped town, or if it found out that the defendant had prior convictions that it didn't know about.
Keep in mind that different states may vary not only in whether they follow the majority or minority view but also in other ways that define how and when either party can back out of a plea deal. For this reason, it's important to talk to a criminal defense attorney.
The law varies from one place to another (including from state to federal court), and the information in this article isn't exhaustive. Only an attorney familiar with the law in your area will know the circumstances under which the prosecution can back out of a plea deal, and whether any or certain statements during the negotiation process could be admissible in court. Professional legal advice is crucial for understanding not only whether the prosecution can back out of a deal but also whether a particular prosecuting office is likely to do so.