Appellant appeals the trial court’s denial of his petition for writ of habeas corpus, challenging its finding that it lacked jurisdiction, as Appellant was incarcerated in another county. Because we treat the petition as a postconviction motion challenging the legality of his sentence and find that it was time barred, we affirm.
The trial court’s dismissal was based on findings of law, which we review de novo. See Sochor v. State, 883 So.2d 766, 772 (Fla.2004) (holding appellate court reviews legal conclusions de novo). We affirm the trial court’s ruling, although not on the grounds stated by the lower court. Applegate v. Barnett Bank of Tallahassee, 377 So.2d 1150, 1152 (Fla.1979) (holding that “[e]ven when based on erroneous reasoning, a conclusion or decision of a trial court will generally be affirmed if the evidence or an alternative theory supports it.”).
The Nassau County Circuit Court was correct in denying Appellant’s petition, because it lacked jurisdiction to consider a petition for a writ of habeas corpus when Appellant was not incarcerated in the same county as the court. A petition for a writ of habeas corpus must be filed in the county in which the prisoner is detained. § 79.09, Fla. Stat. We, however, treat Appellant’s petition as a postconviction motion, as it challenges the legality of his sentence, and deny it because it was time barred. Fla. R.Crim. P. 3.850(b) (“motion shall be filed or considered pursuant to this rule if filed more than 2 years after the judgment and sentence became final.”). This bar is jurisdictional and may not be waived. See Ferenc v. State, 697 So.2d 1262, 1263 (Fla. 5th DCA 1997) (holding that “[i]n the absence of an exception, a motion filed outside the two-year period will not invoke the jurisdiction of the trial court.”). The two-year time limitation for postconviction motions cannot be avoided by the filing of a petition for writ of habeas corpus. See Finley v. State, 394 So.2d 215, 216 (Fla. 1st DCA 1981) (holding that “[t]he remedy of habeas corpus is not available as a substitute for post-conviction relief under Rule 3.850”).
Appellant is warned that this is his fourth attempt to obtain collateral relief, and it is a frivolous filing. As this court noted in Clift v. State, 43 So.3d 778, 778 (Fla. 1st DCA 2010), filings without merit or frivolous filings may result in Appellant’s referral to the Department of Corrections for disciplinary procedures in accordance with section 944.279, Florida Statutes.
AFFIRMED.
ROBERTS and CLARK, JJ., concur.