Antwyan Dorn appeals from the trial court’s order denying his petition for writ of habeas corpus. In his petition, Dorn alleged his incarceration is illegal and that he is entitled to immediate release. The gravamen of his claim, however, is an attack on the validity of the underlying conviction, rather than the legality of his current incarceration. Although Dorn is currently incarcerated in a facility located in Miami-Dade County, the underlying prosecution, and the subsequent conviction and sentence, occurred in Volusia County. As we have previously explained:
The circuit court of the county in which a defendant is incarcerated has jurisdiction to consider a petition for writ of habeas corpus when the claims raised in the petition concern issues regarding his incarceration, but not when the claims attack the validity of the judgment or sentence. Only the court in which the defendant was convicted and sentenced *563has jurisdiction to consider collateral attacks on a judgment or sentence, and such an attack must be brought pursuant to Rule 3.800 or 3.850, not by petition for writ of habeas corpus.
Broom v. State, 907 So.2d 1261, 1262 (Fla. 3d DCA 2005) (citations omitted).
The trial court correctly determined that it lacked jurisdiction to consider the claim raised in Dorn’s petition. Although the trial court denied (rather than dismissed) the petition,1 we affirm the denial for purposes of judicial economy. Richardson, 918 So.2d at 1004. In so doing, we note that the trial court’s order was not a merits determination, and our affirmance is without prejudice for Dorn to seek appropriate relief in the Circuit Court of the Seventh Judicial Circuit in and for Volusia County.
Affirmed without prejudice to petitioner seeking appropriate relief in the Circuit Court of the Seventh Judicial Circuit in and for Volusia County.
. Because the trial court concluded it lacked jurisdiction to consider the petition and therefore did not reach the merits of Dorn’s claim, the court should have dismissed, rather than denied, the petition. See Richardson v. State, 918 So.2d 999, 1001 (Fla. 5th DCA 2006)