
970 So.2d 880 (2007)
Keith Errol HOGARTH, Appellant,
v.
STATE of Florida, Appellee.
No. 1D06-6427.
District Court of Appeal of Florida, First District.
December 17, 2007.
Keith Errol Hogarth, pro se, Appellant.
Bill McCollum, Attorney General, Giselle Lylen Rivera and Elizabeth F. Duffy, Assistant Attorneys General, Tallahassee, for Appellee.
PER CURIAM.
The appellant challenges the trial court's order denying his petition for writ of habeas corpus which was treated as a rule 3.850 motion. Because the trial court's order was issued while the appellant's direct appeal of judgment and sentence was pending, we reverse.
The trial court erred in ruling on the appellant's motion for postconviction relief while the appellant's case was the subject of a pending direct appeal. See McDaniel v. State, 789 So.2d 1223, 1224 (Fla. 1st DCA 2001). Instead, the trial court should have dismissed the motion with leave to refile after the direct appeal was final. *881 See Matthews v. State, 889 So.2d 893 (Fla. 2d DCA 2004).
Accordingly, the trial court's order is reversed and the cause remanded to the trial court with instructions to dismiss the appellant's motion for lack of jurisdiction without prejudice.
REVERSED AND REMANDED.
POLSTON, HAWKES, and THOMAS, JJ., concur.
