I respectfully dissent. Judge Evans granted Kocontes's motion to dismiss in case No. 13CF0463 "for lack of territorial jurisdiction." As I will explain, a dismissal for lack of territorial jurisdiction is not a dismissal in the furtherance of justice within the meaning of Penal Code section 1385 (all *1249further statutory references are to this code), and it is not subject to the "two-dismissal" rule of section 1387.
"A dismissal for lack of territorial jurisdiction is qualitatively different from those situations in which dismissals in the furtherance of justice [under section 1385 ] have been approved. In the former situation, the court is not empowered to hear the case; in the latter it chooses to dismiss the case because other factors outweigh its authority to act." (Casey v. Superior Court (1989) 207 Cal.App.3d 837, 844, 255 Cal.Rptr. 81 (Casey ).)
The conclusion that a dismissal for lack of territorial jurisdiction is not a dismissal under section 1385 is supported by the fact a number of methods exist to challenge a court's power to hear a case. If a court acts in excess of its territorial jurisdiction, a defendant may seek relief through extraordinary measures such as habeas corpus to prevent a court from proceeding. (§ 1487;
*856In re Huber (1930) 103 Cal.App. 315, 284 P. 509.) Likewise, the lack of territorial jurisdiction may be raised in a motion for new trial or on appeal. (See, e.g., People v. Gerundo (1952) 112 Cal.App.2d 863, 865-869, 247 P.2d 398.)
Further, section 1385 explicitly limits the types of dismissals which can be considered to have been made in the furtherance of justice by providing: "A dismissal shall not be made for any cause that would be ground of demurrer to the accusatory pleading." (§ 1385, subd. (a).) Lack of jurisdiction is a ground for demurrer. (§ 1004, subd. (1).) And because this type of defect cannot be cured by amendment, an action in excess of territorial jurisdiction must be dismissed pursuant to section 1008 after the demurrer is sustained, which is exactly what Judge Evans did in case No. 13CF0463.
Finally, dismissals made pursuant to section 1008 are not among the terminating orders specifically enumerated in section 1387. So the two-dismissal rule of section 1387 does not apply. (Casey, supra, 207 Cal.App.3d at pp. 844-845, 255 Cal.Rptr. 81.)
In sum, Judge Evans's dismissal for lack of territorial jurisdiction in case No. 13CF0463 was not a dismissal within the meaning of section 1385 and the two-dismissal rule of section 1387 did not apply. For these reasons: (a) the People were not authorized to file the complaint in case No. 13CF1773 or seek the indictment in case No. 13ZF0163; and (b) the only manner in which the People were authorized to challenge the dismissal was to appeal, which they did, although they later abandoned that appeal.
Under these circumstances, Judge Prickett erred by overruling Kocontes's demurrer and denying his motion to dismiss in case No. 13ZF0163. To hold *1250otherwise is to permit prosecutorial forum shopping, to sanction refilling dismissed charges in the hope that a different judge will view the territorial jurisdiction issue more favorably, and to deprive this court of its jurisdiction to review the correctness of Judge Evans's ruling. The petition for habeas corpus must be granted to prevent the trial court from proceeding.