
779 So.2d 604 (2001)
Harold GRAHAM, Appellant,
v.
STATE of Florida, Appellee.
No. 2D99-4612.
District Court of Appeal of Florida, Second District.
February 28, 2001.
*605 James Marion Moorman, Public Defender, and A. Victoria Wiggins, Assistant Public Defender, Bartow, for Appellant.
Robert A. Butterworth, Attorney General, Tallahassee, and Robert J. Krauss, Senior Assistant Attorney General, Tampa, for Appellee.
BLUE, Acting Chief Judge.
Prior to sentencing, Harold Graham sought to withdraw his plea because it was based on defense counsel's mistaken advice. The trial court denied the motion and sentenced Graham for lewd and lascivious conduct in the presence of a child under sixteen, a second-degree felony in violation of section 800.04(4), Florida Statutes (1997), and failure to report, a second-degree misdemeanor in violation of sections 39.201 and 39.205, Florida Statutes (Supp.1998). Because Graham's plea was based on mistaken advice from counsel, we conclude that he established good cause for withdrawing his plea. Accordingly, we reverse.
Florida Rule of Criminal Procedure 3.170(f) states that "[t]he court may in its discretion, and shall on good cause, at any time before a sentence, permit a plea of guilty to be withdrawn and, if judgment of conviction has been entered thereon, set aside the judgment and allow a plea of not guilty."[1] In seeking to withdraw a plea prior to sentencing, "[t]he burden is upon a defendant to establish good cause under the rule, and use of the word "shall" indicates that such a showing entitles a defendant to withdraw a plea as a matter of right." Robinson v. State, 761 So.2d 269, 274 (Fla.1999) (quoting Yesnes v. State, 440 So.2d 628, 634 (Fla. 1st DCA 1983)). The law favors a trial on the merits, and this rule should be liberally construed in favor of the defendant. See Robinson, 761 So.2d at 274. A defendant should be allowed to withdraw a plea that was "entered under mental weakness, mistake, surprise, misapprehension, fear, promise, or other circumstances affecting his rights." Baker v. State, 408 So.2d 686, 687 (Fla. 2d DCA 1982). The standard of review on appeal is abuse of discretion. See Robinson, 761 So.2d at 274.
In this case, the record establishes that Graham sought to withdraw his plea prior to sentencing based on counsel's mistaken advice regarding a collateral consequence. While counsel is not required to warn a defendant about collateral consequences of a plea, if collateral matters are discussed and counsel's advice is "measurably deficient," then a plea based on that advice could be involuntary. Dolan v. State, 618 So.2d 271, 273 (Fla. 2d DCA 1993) (addressing postconviction motion seeking plea withdrawal). The record shows that Graham entered his plea under the mistaken assurances by defense counsel that his photo would not be placed on the Internet. Graham testified that he asked his attorney about this point several times before the plea and would not have entered the plea if he had been told that his picture would be on the Internet. We conclude that the trial court abused its discretion by failing to allow Graham to withdraw his plea prior to sentencing. Accordingly, we reverse.
Reversed and remanded for further proceedings.
FULMER and DAVIS, JJ., concur.
NOTES
[1]  "The same rules apply to the withdrawal of a plea of nolo contendere as apply to the withdrawal of a guilty plea." Stovall v. State, 252 So.2d 376, 378 (Fla. 4th DCA 1971).
