Opinion
SWAGER, J.The Attorney General has taken this appeal from a judgment in this habeas corpus proceeding that discharged respondent from the duty to register as a sex offender pursuant to Penal Code section 290,1 and removed his identity or any “information regarding him” from “databases of sexual offenders.” We conclude that the Attorney General is not foreclosed by principles of waiver or estoppel from challenging the judgment in this appeal. We also conclude that the judgment granting respondent habeas corpus relief is in excess of the trial court’s authority in the absence of evidence he was in actual or constructive custody. We therefore reverse the judgment and remand the case to the trial court to grant respondent the opportunity to file an appropriate action.
STATEMENT OF FACTS AND PROCEDURAL HISTORY
In 1995, respondent, a physician who resides in San Francisco, began an Internet and telephone relationship with Jill N., a 41-year-old woman who represented to him that her name was “Jill Armstrong,”2 and that she was 18 years old. In February of 1996, while respondent was traveling to a professional conference in North Carolina, he arranged to meet Jill at a hotel. In fact, the girl he met was Jill’s 14-year-old daughter Lauren. Jill had persuaded or coerced her daughter to meet men for sexual contact. According to the petition, when respondent met Lauren she claimed to be 18-year-old Jill, and based upon her appearance and demeanor he believed her. The declarations of both respondent and Lauren maintain that they engaged in entirely consensual sexual contact—of a nature not disclosed by the record—during this single encounter.3 Respondent also asserted in the petition that he was “duped” as to “the girl’s age” by Jill, and had no intent to engage in sex with an underage girl.
*70Two years later, a criminal investigation ensued in North Carolina during which respondent learned the “truth” of his encounter with Lauren. In March of 2000, respondent entered a guilty plea in North Carolina to taking indecent liberties with a child in violation of North Carolina General Statutes, section 14-202.1. Execution of sentence was suspended, and respondent was placed on felony probation for two years.4 The record on appeal does not indicate that respondent was ordered by the North Carolina judgment to register as a sex offender.5
Respondent’s probation was thereafter transferred to San Francisco. Respondent was advised by his probation officer in California that he was required to register as a sex offender under section 290,6 and he did so. By 2002, respondent successfully completed his probation in the North Carolina case, but continued to register as a sex offender as required. He also reported his felony conviction to the California Medical Board (the Medical Board), *71and as part of a stipulated settlement agreed to five years of supervised probation. He received psychiatric evaluation as ordered by the Board, and was found fit to continue to practice medicine.
In 2003, Business and Professions Code section 2232 was enacted, which provides that the Medical Board “shall promptly revoke the license of any person who, at any time after January 1, 1947, has been required to register as a sex offender pursuant to the provisions of Section 290 of the Penal Code.” In 2004, after section 2232 became effective, respondent was informed by the Medical Board that proceedings to revoke his medical license had been initiated “due to [his] registration status.” Respondent declared that through his attorney he had contact with the Attorney General’s Office about “medical licensure issues,” and was advised that he is “not legally required to register” as a sex offender under section 290. Nevertheless, the Medical Board has indicated to respondent that proceedings to confiscate his medical license will continue unless he is relieved by court order of the obligation to register as a sex offender.
Respondent filed the present petition for writ of habeas corpus on December 17, 2004, which requested an order directing the Police Department of San Francisco and the State of California to desist from requiring him to comply with the sex offender registration requirements of section 290. Respondent has alleged in the petition that his liberty is “unlawfully restrained” and he is subject to “constructive custody” or may face “criminal prosecution” unless his duty to register is terminated.
On April 25, 2005, the trial court issued an order to show cause to the San Francisco District Attorney’s Office and the California Attorney General’s Office to appear and demonstrate “why [respondent] should be required to register under PC § 290.”7 At a hearing on May 9, 2005, upon learning that the District Attorney and the Attorney General intended to oppose the petition, the court continued the matter for additional briefing or response, and set a further hearing on the matter for June 22, 2005. . The *72District Attorney subsequently filed written opposition to the petition.8 The Attorney General’s apparent sole opposition to the petition was to file a declaration to the effect that no opinion had been given to respondent that he “was not legally required to register as a sex offender,” and a review of registration documents indicated he “is legally required to register as a sex offender.”
The hearing was then continued' until October 12, 2005. Neither the District Attorney nor the Attorney General filed any further response to the order to show cause. On October 5, 2005, a hearing occurred, without any appearance by the Attorney General. The record before us contains no information concerning the circumstances under which this hearing was set and no indication that the Attorney General was noticed or was aware of this hearing.9 The District Attorney was present and stated that “the People are withdrawing their opposition to the defendant’s petition.” “In light of that” pronouncement by the District Attorney, the court issued the judgment granting the writ. This appeal by the Attorney General followed.
DISCUSSION
The Attorney General claims that the trial court erred by granting habeas corpus relief under section 1473 where respondent “was not in actual or constructive custody of the state at the time he filed his petition.” The position of the Attorney General is that absent evidence of respondent’s custody the trial court “lacked fundamental jurisdiction to grant habeas corpus relief.” Appellant adds that even if the petition is considered on the merits respondent failed to offer evidence that he is not required to register as a sex offender in California under section 290, and thus he is not entitled to the relief granted.
I. Appellant’s Failure to Oppose the Petition.
Respondent acknowledges that his petition for writ of habeas corpus was “an incorrect remedy,” but argues that the Attorney General is foreclosed from contesting the ruling on the petition by failing to “answer the court’s order to show cause or to oppose [the] respondent’s writ petition in the trial court.” Respondent maintains that the trial court did not lack “fundamental subject matter jurisdiction,” and therefore the failure of the Attorney General to file written response to the order to show cause or appear at the hearing on *73October 5, 2005, to oppose the writ petition constitutes a “waiver or estoppel” on appeal. The Attorney General responds that jurisdiction “cannot be conferred by waiver, consent, or estoppel,” so the issue of propriety of writ relief is cognizable in this appeal.
In resolving the waiver or estoppel issues, we are presented with a somewhat confusing and atypical series of procedural events. Respondent directed his petition to the San Francisco Police Department and the State of California, respectively. As related to the enforcement of the sex offender registration laws, the District Attorney represented the interests of the City and County of San Francisco, while the Attorney General represented the interests of the State of California, and the Medical Board, as the chief law enforcement officer of the state. (See Pitts v. County of Kern (1998) 17 Cal.4th 340, 357 [70 Cal.Rptr.2d 823, 949 P.2d 920]; D’Amico v. Board of Medical Examiners (1974) 11 Cal.3d 1, 14 [112 Cal.Rptr. 786, 520 P.2d 10]; People v. Parmar (2001) 86 Cal.App.4th 781, 797-798 [104 Cal.Rptr.2d 31].)10 The order to show cause was directed to both the District Attorney and the Attorney General. The District Attorney filed written opposition to the petition, supplemented with a single supporting declaration from the Attorney General. The action then took an unusual twist when the scheduled hearing on the order to show cause was inexplicably advanced a week, the Attorney General failed to appear, and the District Attorney suddenly reversed its prior opposition to the petition. We thus are presented with essentially a concession by one representative of the People—the District Attorney—and a failure to appear or object under rather ambiguous circumstances by the other representative of the People—the Attorney General.
A. Forfeiture or Waiver.
We have no doubt that the District Attorney entered a waiver of the right to contest the petition by formally withdrawing opposition and thereby effectively stipulating to entry of the judgment in favor of respondent. We do *74not, however, under the circumstances presented, attribute the District Attorney’s waiver to the Attorney General. This is not a case in which the District Attorney, as it often does, was acting in the capacity of sole public prosecutor for the state under the “direct supervision” of the Attorney General. (Cal. Const., art. V, § 13; Pacific Gas & Electric Co. v. County of Stanislaus (1997) 16 Cal.4th 1143, 1151 [69 Cal.Rptr.2d 329, 947 P.2d 291]; Shepherd v. Superior Court (1976) 17 Cal.3d 107, 122 [130 Cal.Rptr. 257, 550 P.2d 161]; People ex rel. Lockyer v. Superior Court (2000) 83 Cal.App.4th 387, 396-397 [99 Cal.Rptr.2d 646]; People v. Terry (1994) 30 Cal.App.4th 97, 101 [35 Cal.Rptr.2d 729].) Where a district attorney acts as an agent and representative of the state under the authority of the Attorney General, the People are ordinarily bound by any stipulations, concessions or representations, regardless of whether counsel was the Attorney General or the district attorney. (See Pitts v. County of Kern, supra, 17 Cal.4th 340, 360; Bach v. County of Butte (1983) 147 Cal.App.3d 554, 570 [195 Cal.Rptr. 268].)
Here, the District Attorney did not represent the interests of the state, and was not acting under the direction of the Attorney General. As far as the record discloses to us, in defense of the case the District Attorney represented only the City and County of San Francisco. The Attorney General separately defended the interests of the state, and did not direct the District Attorney in any way in the litigation. Nothing in the record demonstrates to us that in reversing its position and withdrawing opposition to the petition the District Attorney acted for the Attorney General.
We are left with the Attorney General’s nonappearance at the hearing and failure to present objections to the petition, which may be found to be a forfeiture of rights, but is not a waiver. Cases have used the word “waiver” “loosely to describe two related, but distinct, concepts: (1) losing a right by failing to assert it, more precisely called forfeiture; and (2) intentionally relinquishing a known right. ‘[T]he terms “waiver” and “forfeiture” have long been used interchangeably. The United States Supreme Court recently observed, however: “Waiver is different from forfeiture. Whereas forfeiture is the failure to make the timely assertion of a right, waiver is the ‘intentional relinquishment or abandonment of a known right.’ [Citations.]” [Citation.]’ [Citation.]” (Cowan v. Superior Court (1996) 14 Cal.4th 367, 371 [58 Cal.Rptr.2d 458, 926 P.2d 438].) Thus, “forfeiture” is the correct legal term to describe the loss of the right to raise an issue on appeal due to the failure to pursue it in the trial court. (In re S.B. (2004) 32 Cal.4th 1287, 1293, fn. 2 [13 Cal.Rptr.3d 786, 90 P.3d 746]; County of Colusa v. California Wildlife Conservation Bd. (2006) 145 Cal.App.4th 637, 657 [52 Cal.Rptr.3d 1].)
Still, a “right may be lost not only by waiver but also by forfeiture, that is, the failure to assert the right in timely fashion.” (People v. Barnum *75(2003) 29 Cal.4th 1210, 1224 [131 Cal.Rptr.2d 499, 64 P.3d 788].) “A ‘reviewing court ordinarily will not consider a challenge to a ruling if an objection could have been but was not made in the trial court. [Citation.] The purpose of this rule is to encourage parties to bring errors to the attention of the trial court, so that they may be corrected. . . .’ [Citation.]” (In re X.V. (2005) 132 Cal.App.4th 794, 804 [33 Cal.Rptr.3d 893].) “The critical point for preservation of claims on appeal is that the asserted error must have been brought to the attention of the trial court.” (Boyle v. CertainTeed Corp. (2006) 137 Cal.App.4th 645, 649 [40 Cal.Rptr.3d 501]; see also In re S.B., supra, 32 Cal.4th 1287, 1293.) “ ‘It is unfair to the trial judge and to the adverse party to take advantage of an alleged error on appeal where it could easily have been corrected at trial. [Citations.]’ [Citation.]” (Cabrini Villas Homeowners Assn. v. Haghverdian (2003) 111 Cal.App.4th 683, 693 [4 Cal.Rptr.3d 192].) “ ‘The parties must call the court’s attention to issues they deem relevant. “ ‘In the hurry of the trial many things may be, and are, overlooked which could readily have been rectified had attention been called to them. The law casts upon the party the duty of looking after his legal rights and of calling the judge’s attention to any infringement of them.’ ” ’ ” (Saville v. Sierra College (2005) 133 Cal.App.4th 857, 872 [36 Cal.Rptr.3d 515].)
“Thus, as a general rule, ‘the failure to object to errors committed at trial relieves the reviewing court of the obligation to consider those errors on appeal.’ [Citations.] This applies to claims based on statutory violations, as well as claims based on violations of fundamental constitutional rights.” (In re Seaton (2004) 34 Cal.4th 193, 198 [17 Cal.Rptr.3d 633, 95 P.3d 896].)
Forfeiture of the right to complain of a ruling of the trial court is not found, however, where the court acted “in ‘excess of its jurisdiction’ ” or beyond its legal authority. (People v. Scott (1994) 9 Cal.4th 331, 354, fh. 17 [36 Cal.Rptr.2d 627, 885 P.2d 1040]; People v. Le (2006) 136 Cal.App.4th 925, 931 [39 Cal.Rptr.3d 146]; Milhous v. Franchise Tax Bd. (2005) 131 Cal.App.4th 1260, 1267-1268 [32 Cal.Rptr.3d 640].) The forfeiture “doctrine does not apply where the trial court exceeds its statutory authority.” (People v. Andrade (2002) 100 Cal.App.4th 351, 354 [121 Cal.Rptr.2d 923]; see also In re Jesse W. (2001) 93 Cal.App.4th 349, 361 [113 Cal.Rptr.2d 184].) Moreover, a reviewing court may consider on appeal “a claim raising a pure question of law on undisputed facts.” (People v. Yeoman (2003) 31 Cal.4th 93, 118 [2 Cal.Rptr.3d 186, 72 P.3d 1166].) The Attorney General’s claim that the trial court exceeded its authority pursuant to section 1473 by granting habeas corpus relief to respondent in the absence of evidence that he was *76“unlawfully imprisoned or restrained of his liberty” presents an issue of law based upon undisputed facts that we may review in the absence of an objection below.11
And even if we were to determine that the Attorney. General affirmatively waived the right to contest the petition in the trial court, or that the District Attorney’s waiver was somehow binding upon the Attorney General, we would not under the circumstances presented conclude that the Attorney General is thereby foreclosed from obtaining review in this appeal of the propriety of granting habeas corpus relief to respondent. This is so despite our disagreement with the Attorney General’s contention that the trial court “lacked fundamental jurisdiction” by granting the habeas corpus petition because respondent “was not in actual or constructive custody of the state as required under section 1473.” The claim is not one that disputes the fundamental jurisdiction of the court—that is, an entire absence of power to hear or determine the case—but rather “refers to a court’s authority to act with respect to persons and subject matter within its power.” (People v. Mower (2002) 28 Cal.4th 457, 474, fn. 6 [122 Cal.Rptr.2d 326, 49 P.3d 1067]; see also People v. McCann (2006) 141 Cal.App.4th 347, 358, fn. 5 [45 Cal.Rptr.3d 868].) The difference between fundamental jurisdiction and acts in excess of jurisdiction has been explained as “the difference between an act of a trial court undertaken without ‘jurisdiction in the fundamental sense’ (a complete absence of authority with respect to the subject of the dispute) and an act undertaken ‘in.excess of jurisdiction, i.e.[,] beyond statutory authority.’” (People v. Ellis (1987) 195 Cal.App.3d 334, 343 [240 Cal.Rptr. 708]; see also Dial 800 v. Fesbinder (2004) 118 Cal.App.4th 32, 42 [12 Cal.Rptr.3d 711]; TrafficSchoolOnline, Inc. v. Superior Court (2001) 89 Cal.App.4th 222, 231 [107 Cal.Rptr.2d 412]; People v. Mendez (1991) 234 Cal.App.3d 1773, 1781-1782 [286 Cal.Rptr. 216].)
“The distinction between a lack of jurisdiction over the cause and an act in excess of jurisdiction has significant consequences. For instance, subject matter jurisdiction cannot be conferred by consent, waiver, or estoppel. *77[Citation.] By contrast, when ‘the court has jurisdiction of the subject, a party who seeks or consents to action beyond the court’s power as defined by statute or decisional rule may be estopped to complain of the ensuing action in excess of jurisdiction.’ [Citation.] ‘A litigant who has stipulated to a procedure in excess of jurisdiction may be estopped to question it when “To hold otherwise would permit the parties to trifle with the courts.” ’ [Citation.]” (People v. National Automobile & Casualty Ins. Co. (2000) 82 Cal.App.4th 120, 125-126 [97 Cal.Rptr.2d 858].)
The Attorney General’s argument that the trial court erred by granting the petition for writ of habeas corpus without evidence of petitioner’s custody presents a claim of lack of authority under the law to grant the particular relief requested, not lack of fundamental jurisdiction. (Cowan v. Superior Court, supra, 14 Cal.4th 367, 374; Gee v. American Realty & Construction, Inc. (2002) 99 Cal.App.4th 1412, 1414 [122 Cal.Rptr.2d 167]; California Coastal Com. v. Tahmassebi (1998) 69 Cal.App.4th 255, 260 [81 Cal.Rptr.2d 321]; Selma Auto Mall II v. Appellate Department (1996) 44 Cal.App.4th 1672, 1684 [52 Cal.Rptr.2d 599].) When particular procedures or remedies are prescribed by statute, “ ‘ “and the court acts contrary to the authority thus conferred, it has exceeded its jurisdiction ....’” [Citations.]” (In re Marriage of Jackson (2006) 136 Cal.App.4th 980, 988 [39 Cal.Rptr.3d 365].) “[A] court’s act in excess of its jurisdiction is valid until set aside, and a party may be precluded from setting it aside, due to waiver, estoppel or the passage of time.” (People v. Tindall (2000) 24 Cal.4th 767, 776, fn. 6 [102 Cal.Rptr.2d 533, 14 P.3d 207]; see also Wozniak v. Lucutz (2002) 102 Cal.App.4th 1031, 1041 [126 Cal.Rptr.2d 310]; In re Jesse W„ supra, 93 Cal.App.4th 349, 359.) The issue before us of the legal authority of the court to grant habeas corpus relief may therefore be subject to principles of consent, estoppel, or waiver, but not, we conclude, under the facts presented here. (In re Jesse W., supra, at p. 359; California Coastal Com. v. Tahmassebi, supra, at p. 260; Law Offices of Ian Herzog v. Law Offices of Joseph M. Fredrics (1998) 61 Cal.App.4th 672, 680 [71 Cal.Rptr.2d 771].)
“Civil Code section 3513 states, ‘Anyone may waive the advantage of a law intended solely for his benefit. But a law established for a public reason cannot be contravened by a private agreement.’ [Citations.]” (Armendariz v. Foundation Health Psychcare Services, Inc. (2000) 24 Cal.4th 83, 100 [99 Cal.Rptr.2d 745, 6 P.3d 669]; see also Arntz Builders v. Superior Court (2004) 122 Cal.App.4th 1195, 1206 [19 Cal.Rptr.3d 346]; Downey Venture v. LMI Ins. Co. (1998) 66 Cal.App.4th 478, 511, fn. 36 [78 Cal.Rptr.2d 142].) “[A] party may waive a statutory right where its ‘ “public benefit ... is merely incidental to [its] primary purpose,” ’ but a waiver is unenforceable where it would ‘ “seriously compromise any public purpose that [the statute was] intended to serve.” ’ [Citation.] Stated another way, Civil Code section 3513 prohibits a waiver of statutory rights where the ‘public benefit [of the statute] *78is one of its primary purposes.’ [Citation.]” (Azteca Construction, Inc. v. ADR Consulting, Inc. (2004) 121 Cal.App.4th 1156, 1166 [18 Cal.Rptr.3d 142].)
Respondent’s duty to register as a sex offender in California under section 290, and, if so, the concomitant duty of the Medical Board to revoke his license under Business and Professions Code section 2232, are inquiries that implicate considerations of crucial and prevailing public interest. “Section 290 ‘applies automatically to the enumerated offenses, and imposes on each person convicted a lifelong obligation to register.’ [Citations.] Registration is mandatory [citation], and is ‘not a permissible subject of plea agreement negotiation’ [citation].” (Wright v. Superior Court (1997) 15 Cal.4th 521, 527 [63 Cal.Rptr.2d 322, 936 P.2d 101].) “ ‘ “ ‘The purpose of section 290 is to assure that persons convicted of the crimes enumerated therein shall be readily available for police surveillance at all times because the Legislature deemed them likely to commit similar offenses in the future. [Citation.]’ ” ’ [Citations.] In recent years, section 290 registration has acquired a second purpose: to notify members of the public of the existence and location of sex offenders so they can take protective measures. (See Stats. 1996, ch. 908, § 1, subd. (b), p. 5105.)” (People v. Hofsheier (2006) 37 Cal.4th 1185, 1196 [39 Cal.Rptr.3d 821, 129 P.3d 29].) “The Legislature also reaffirmed ‘it is necessary to provide for continued registration’ to effectuate the statutory purpose of protecting the safety and general welfare of the public. [Citations.]” (Wright v. Superior Court, supra, at p. 529.) “It is intended to promote the ‘ “state interest in controlling crime and preventing recidivism in sex offenders.” ’ [Citation.]” (Id. at p. 527.) “ ‘ “Plainly, the Legislature perceives that sex offenders pose a ‘continuing threat to society’ [citation] and require constant vigilance. [Citation.]” [Citation.]’ ” (People v. Sorden (2005) 36 Cal.4th 65, 73 [29 Cal.Rptr.3d 777, 113 P.3d 565], quoting People v. Barker (2004) 34 Cal.4th 345, 357 [18 Cal.Rptr.3d 260, 96 P.3d 507].) “The Legislature has found it imperative for the safety of society that the location of sex offenders be known to law enforcement at all times, thus requiring defendants subject to section 290 to reregister annually and upon a change of location serves that purpose by providing law enforcement with updated information through which it may track these defendants.” (People v. Meeks (2004) 123 Cal.App.4th 695, 702 [20 Cal.Rptr.3d 445].)
Due to the vital public importance associated with sex offender registration, “The duty to register as a sex offender under section 290, subdivision (a), cannot be avoided through a plea bargain [citation] or through the exercise of judicial discretion.” (People v. Hofsheier, supra, 37 Cal.4th 1185, 1196.) “ ‘ “Without it law enforcement efforts will be frustrated and the statutory purpose thwarted. The statute is thus regulatory in nature, intended to accomplish the government’s objective by mandating certain affirmative acts. Compliance is essential to that objective; lack of compliance fatal.” [Citation.]’ [Citation.]” (People v. Sorden, supra, 36 Cal.4th 65, 73.) *79Thus, the sex offender registration requirement is “a statutorily mandated element of punishment for the underlying offense” that “is not a permissible subject of plea agreement negotiation; neither the prosecution nor the sentencing court has the authority to alter the legislative mandate” that a person convicted of a qualifying offense “shall register as a sex offender pursuant to the provisions set forth in section 290.” (People v. McClellan (1993) 6 Cal.4th 367, 380 [24 Cal.Rptr.2d 739, 862 P.2d 739].) Nor, we conclude, is the legislative mandate of sex offender registration a permissible subject of waiver or concession in the present writ proceeding, where the public interest in litigating respondent’s duty to register as a sex offender must be given foremost consideration.
Further, public safety is a paramount concern in a Medical Board proceeding. (Gray v. Superior Court (2005) 125 Cal.App.4th 629, 640 [23 Cal.Rptr.3d 50].) The Medical Board’s disciplinary proceedings “are intended to protect the public.” (Medical Board v. Superior Court (2003) 111 Cal.App.4th 163, 173 [4 Cal.Rptr.3d 403]; see also Bryce v. Board of Medical Quality Assurance (1986) 184 Cal.App.3d 1471, 1476 [229 Cal.Rptr. 483].) The Legislature “established revocation and suspension proceedings for medical licenses in order ‘to protect the life, health and welfare of the people at large and to set up a plan whereby those who practice medicine will have the qualifications which will prevent, as far as possible, the evils which could result from ignorance or incompetency or a lack of honesty and integrity.’ Similarly, in Shea v. Board of Medical Examiners (1978) 81 Cal.App.3d 564, 574 [146 Cal.Rptr. 653], the court stated, ‘The purpose of the State Medical Practice Act ([Bus. & Prof. Code,] § 2000 et seq.) is to assure the high quality of medical practice; in other words, to keep unqualified and undesirable persons and those guilty of unprofessional conduct out of the medical profession. [Citations.]’ Certainly, a chief purpose of the Medical Practice Act has always been public protection.” (Borden v. Division of Medical Quality (1994) 30 Cal.App.4th 874, 883 [35 Cal.Rptr.2d 905].) Given the overriding public interest attached to the issues of respondent’s duty to register as a sex offender and the resulting revocation of his medical license, we find that no waiver on appeal resulted from the District Attorney’s effective concession or the Attorney General’s failure to appear at the hearing to contest the petition.
B. Estoppel
For essentially the same reasons we also find that despite the lack of objection below the Attorney General is not estopped in any manner from challenging the order, as respondent maintains. We acknowledge the established rule that, “ ‘Unlike some other jurisdictional defects, a party may, by its conduct, be estopped from contesting an action in excess of jurisdiction.’ [Citation.]” (Conservatorship of O’Connor (1996) 48 Cal.App.4th 1076, 1092 *80[56 Cal.Rptr.2d 386]; accord, People v. National Automobile & Casualty Ins. Co., supra, 82 Cal.App.4th 120, 125-126; see also People v. Level (2002) 97 Cal.App.4th 1208, 1213 [119 Cal.Rptr.2d 551]; People v. Frontier Pacific Ins. Co. (2000) 83 Cal.App.4th 1289, 1293 [100 Cal.Rptr.2d 433].) Parties are estopped from complaining of results or orders with which they expressed agreement. (People v. Buttram (2003) 30 Cal.4th 773, 783 [134 Cal.Rptr.2d 571, 69 P.3d 420].) Also, “under the doctrine of judicial estoppel, \ . . a party who has taken a particular position in litigation may, under some circumstances, be estopped from taking an inconsistent position to the detriment of the other party.’ [Citation.]” (California Coastal Com. v. Tahmassebi, supra, 69 Cal.App.4th 255, 259.)
For several reasons, however, we do not find appellant bound by principles of estoppel in the present case. “ ‘ “Whether [a party who seeks or consents to action beyond the court’s power] shall be estopped depends on the importance of the irregularity not only to the parties but to the functioning of the courts and in some instances on other considerations of public policy. . . .” [Citations.]’ [Citations.]” (Lovett v. Carrasco (1998) 63 Cal.App.4th 48, 54 [73 Cal.Rptr.2d 496]; see also In re Omar R. (2003) 105 Cal.App.4th 1434, 1438 [129 Cal.Rptr.2d 912]; People v. Mendez, supra, 234 Cal.App.3d 1773, 1782.) Here, the Attorney General is not now taking a position before this court that is contrary to a position taken below, or belatedly challenging a result generated by a procedure it approved or initiated. (Cf. Gee v. American Realty & Construction, Inc., supra, 99 Cal.App.4th 1412, 1414.) The District Attorney, not the Attorney General, withdrew opposition to the petition. The record fails to disclose that the Attorney General ever advocated or even ratified the position ultimately taken by the District Attorney at the order to show cause hearing. As we have observed, the District Attorney and Attorney General acted as separate parties in this litigation, and the former’s concession cannot be imposed upon the latter. (People v. Mendez, supra, at pp. 1780-1781.) Thus, the Attorney General did not “trifle” with the court or stipulate to an order in excess of the trial court’s jurisdiction. (Jovine v. FHP, Inc. (1998), 64 Cal.App.4th 1506, 1531 [76 Cal.Rptr.2d 322].)
Moreover, to ratify, on the grounds of either waiver or estoppel, the trial court’s ruling engendered by the District Attorney’s concession would, as we have also discussed, effectively undermine two inquiries that impact important public policies: first, the continuing duty of respondent to register as a sex offender in California under section 290; and second, the propriety of the revocation of respondent’s medical license. Given the failure of the Attorney General to affirmatively join in the District Attorney’s withdrawal of opposition to the petition or in any way indicate concession to the order—and particularly given the unusual nature of the proceeding whereby the hearing was advanced a week apparently without notice to the Attorney General—we *81are persuaded that considerations of public policy do not favor denying appellant the opportunity of contesting the trial court’s ruling on appeal. (County of Los Angeles v. Ranger Ins. Co. (1999) 70 Cal.App.4th 10, 18 [82 Cal.Rptr.2d 214]; People v. Blakeman (1959) 170 Cal.App.2d 596, 598 [339 P.2d 202].) “ ‘Substantive rules based on public policy sometimes control the allowance or disallowance of estoppel.’ [Citation.]” (Jovine v. FHP, Inc., supra, 64 Cal.App.4th 1506, 1530.) We proceed to examine the merits of appellant’s contention that the trial court’s order was in excess of its jurisdiction in a habeas corpus proceeding.
II. The Judgment Granting Habeas Corpus Relief Without Evidence of Respondent’s Custody.
There is really no dispute that the trial court lacked authority to grant respondent relief as requested in his petition for writ of habeas corpus. Respondent was never in custody and his probation terminated long before the petition was filed. Thus, he did not establish an essential element of habeas corpus relief.
The petition for writ of habeas corpus is a “ ‘ “remedy known to the law whereby one unlawfully restrained of his [or her] liberty can secure his [or her] release . . . .” [Citation.]’ [Citation.] ‘The writ has been available to secure release from unlawful restraint since the founding of the state.’ ” {Board of Prison Terms v. Superior Court (2005) 130 Cal.App.4th 1212, 1233 [31 Cal.Rptr.3d 70]; see also Cal. Const, of 1849, art. I, § 5; Stats. 1850, ch. 122, p. 334; Matter of Ford (1911) 160 Cal. 334, 340 [116 P. 757].) “ ‘It continues to serve this purpose today under our law.’ [Citation.] ‘Through a habeas corpus proceeding, a court may grant relief from various forms of constructive custody, as well as from physical restraints.’ [Citation.]” {In re Azurin (2001) 87 Cal.App.4th 20, 23 [104 Cal.Rptr.2d 284]; see also People v. Romero (1994) 8 Cal.4th 728, 736-737 [35 Cal.Rptr.2d 270, 883 P.2d 388].) “Our state Constitution guarantees that a person improperly deprived of his or her liberty has the right to petition for a writ of habeas corpus.” {People v. Duvall (1995) 9 Cal.4th 464, 474 [37 Cal.Rptr.2d 259, 886 P.2d 1252].)
However, habeas corpus relief is subject to a “valid limitation. Thus, it is well settled that the writ of habeas corpus does not afford an all-inclusive remedy available at all times as a matter of right. It is generally regarded as a special proceeding. ‘Where one restrained pursuant to legal proceedings seeks release upon habeas corpus, the function of the writ is merely to determine the legality of the detention by an inquiry into the question of jurisdiction and the validity of the process upon its face, and whether anything has transpired since the process was issued to render it invalid.’ [Citation.]” {In re Fortenbury (1940) 38 Cal.App.2d 284, 289 [101 P.2d 105].) The habeas corpus petitioner *82“bears a heavy burden to first plead sufficient grounds for relief, then prove them” and then must prove the facts that establish by a preponderance of the evidence the basis for relief. (Younan v. Caruso (1996) 51 Cal.App.4th 401, 407 [59 Cal.Rptr.2d 103]; accord, In re Lucas (2004) 33 Cal.4th 682, 694 [16 Cal.Rptr.3d 331, 94 P.3d 477]; see also People v. Duvall, supra, 9 Cal.4th 464, 474.)
In resolving a petition for writ of habeas corpus, we “ ‘must abide by the procedures set forth in Penal Code sections 1473 through 1508.’ [Citation.]” (People v. Romero, supra, 8 Cal.4th 728, 737.) Section 1473, subdivision (a), specifies that “Every person unlawfully imprisoned or restrained of his liberty, under any pretense whatever, may prosecute a writ of habeas corpus, to inquire into the cause of such imprisonment or restraint.” (Italics added.) Section 1477 adds: “The writ must be directed to the person having custody of or restraining the person on whose behalf the application is made, and must command him to have the body of such person before the Court or Judge before whom the writ is returnable, at a time and place therein specified.” (Italics added.)
“ ‘[T]he decisional law of recent years has expanded the writ’s application to persons who are determined to be in constructive custody,’ ” in addition to “ ‘those persons physically imprisoned,’ ” so that “ ‘the writ is available to one on parole . . ., probation . . ., bail. . . , or a sentenced prisoner released on his own recognizance pending hearing on the merits of his petition. . . . The thrust of these cases is that a person is in custody constructively if he may later lose his liberty and be eventually incarcerated.’ [Citation.]” (In re Azurin, supra, 87 Cal.App.4th 20, 23.) But where the petitioner is “neither actually nor constructively restrained, such writ would be inappropriate.” (Williams v. Department of Motor Vehicles (1969) 2 Cal.App.3d 949, 952 [83 Cal.Rptr. 76].)
Although respondent asserted in his petition that “his liberty is unlawfully restrained in violation of the laws of the State of California,” for purposes of proving entitlement to habeas corpus relief in the present case, he is not. Respondent’s allegation that he is “under the constructive custody of the State of California because if he fails to register, he is subject to criminal prosecution” does not “satisfy the habeas corpus jurisdictional requirements under California law.” (In re Azurin, supra, 87 Cal.App.4th 20, 25.) Since respondent “is not in prison or on probation or parole or otherwise in constructive custody, the remedy of habeas corpus is not available to him—and it is immaterial that lingering noncustodial collateral consequences are still attached to his conviction.” (Mendez v. Superior Court (2001) 87 Cal.App.4th 791, 796 [104 Cal.Rptr.2d 839].) Neither the prospect of the loss of respondent’s medical license nor the speculative risk of future custody in the event *83he fails to register as a sex offender proves constructive custody as required in a habeas corpus action. (See id. at p. 801; In re Azurin, supra, at pp. 25-26; Williams v. Department of Motor Vehicles, supra, 2 Cal.App.3d 949, 951-952.) The “states’ sexual offender registration laws do not render a habeas petitioner ‘in custody’ because they are a collateral consequence of conviction that do not impose a severe restraint on an individual’s liberty. [Citations.]” (Resendiz v. Kovensky (9th Cir. 2005) 416 F.3d 952, 959.) “[T]he registration requirement is merely a collateral consequence of conviction that is ‘not [itself] sufficient to render an individual “in custody” for the purposes of a habeas attack upon it.’ [Citation.]” (Henry v. Lungren (1999) 164 F.3d 1240, 1242; see also Leslie v. Randle (6th Cir. 2002) 296 F.3d 518, 522.) The “habeas corpus petition did not meet the habeas corpus jurisdictional requirements of California law,” and therefore “the superior court erred in granting his petition.” (In re Azurin, supra, 87 Cal.App.4th 20, 26; see also id. at pp. 24-26; In re Wessley W. (1981) 125 Cal.App.3d 240, 246-247 [181 Cal.Rptr. 401].)12
III. Treating the Pleading as a Petition for Writ of Mandate.
Respondent argues that “the fact that he mislabeled his writ petition as one for habeas corpus” did not “deprive the superior court of subject matter jurisdiction” to “consider the validity of the registration requirement as it applied” to him and grant relief by treating the petition as “one for mandate.” He claims that “the People were not prejudiced” by the “wrong label” on the petition, and the “lower court’s order is not void for want of jurisdiction.”
We agree with the general principle espoused by respondent that on appeal we are not precluded from considering a petition for writ of habeas corpus pleading “to be a petition for writ of mandamus. [Citation.] The label given a petition, action or other pleading is not determinative; rather, the true nature of a petition or cause of action is based on the facts alleged and remedy sought in that pleading.” (Escamilla v. California Dept. of Corrections & Rehabilitation (2006) 141 Cal.App.4th 498, 511 [46 Cal.Rptr.3d 408].) Treating a habeas corpus petition on appeal as one seeking a writ of mandate is particularly appropriate where an allegation is made of an act committed in excess of jurisdiction—here, unlawfully requiring respondent to register as a sex offender—the issue presented is purely legal in nature, and there is no need for an evidentiary hearing permitted by the procedures governing habeas corpus petitions. (See Alfredo A. v. Superior Court (1994) 6 Cal.4th 1212, 1217 [26 Cal.Rptr.2d 623, 865 P.2d 56]; Gray v. Superior Court, supra, 125 Cal.App.4th 629, 636 & fn. 3; Rose v. Superior Court (2000) 81 Cal.App.4th *84564, 568 [96 Cal.Rptr.2d 843]; Thomas v. Superior Court (1984) 162 Cal.App.3d 728, 729-730 [208 Cal.Rptr. 712].)
“Code of Civil Procedure section 1085 permits the issuance of a writ of mandate ‘to compel the performance of an act which the law specially enjoins.’ [Citation.] The writ will lie where the petitioner has no plain, speedy and adequate alternative remedy, the respondent has a clear, present and usually ministerial duty to perform, and the petitioner has a clear, present and beneficial right to performance. [Citations.] Mandate is not available to compel the exercise of discretion on the part of a public official, but it is available to correct an abuse of discretion.” {Kong v. City of Hawaiian Gardens Redevelopment Agency (2002) 101 Cal.App.4th 1317, 1325-1326 [125 Cal.Rptr.2d 1].) “ ‘A ministerial act is an act that a public officer is required to perform in a prescribed manner in obedience to the mandate of legal authority and without regard to his own judgment or opinion concerning such act’s propriety or impropriety, when a given state of facts exists.’ [Citation.]” {Kavanaugh v. West Sonoma County Union High School Dist. (2003) 29 Cal.4th 911, 916 [129 Cal.Rptr.2d 811, 62 P.3d 54].) A writ of mandate may “ ‘issue against a county, city or other public body or against a public officer. [Citations.] However, the writ will not lie to control discretion conferred upon a public officer or agency. [Citations.] Two basic requirements are essential to tire issuance of the writ: (1) A clear, present and usually ministerial duty upon the part of the respondent [citations]; and (2) a clear, present and beneficial right in the petitioner to the performance of that duty [citation] . . . .’ [Citations.]” (Venice Town Council, Inc. v. City of Los Angeles (1996) 47 Cal.App.4th 1547, 1558 [55 Cal.Rptr.2d 465].)
On the record presented to us, however, we are not inclined to exercise our discretion to treat the pleading as a petition for writ of mandate and resolve the claim on the merits. To obtain a writ of mandate, respondent must show that appellant has the duty to absolve him from the requirement to register as a sex offender under the provisions of section 290.13 Due to the District Attorney’s withdrawal of opposition and apparent lack of notice to the Attorney General, we do not have before us all of the evidence necessary to confidently determine respondent’s duty to register under section 290. For instance, the record of the North Carolina judgment is not at all clear with regard to a registration order. We have taken judicial notice of a document that indicates respondent registered as a sex offender in North Carolina, but that document was not presented to the trial court, and we cannot consider the truth of its contents. {People v. Woodell (1998) 17 Cal.4th 448, 455 [71 Cal.Rptr.2d 241, 950 P.2d 85].) Further, the document does not explain the circumstances under which registration occurred—that is, was it compelled
13 *85by the North Carolina conviction, and if so, under what conditions. We therefore decline to affirm the judgment by treating the present petition as one for writ of mandate.
DISPOSITION
Accordingly, the judgment is reversed and the case is remanded to the trial court with directions to grant respondent the opportunity to amend his pleading within 30 days to allege a petition for writ of mandate, and thereafter to conduct appropriate proceedings. We express no opinion as to the merits of any further proceedings.
Marchiano, P. J., and Margulies, J., concurred.
On July 12, 2007, the opinion was modified to read as printed above.
All further statutory references are to the Penal Code unless otherwise indicated.
We will refer to Jill N. and her pseudonym Jill Armstrong as Jill.
Lauren did not have any telephone or Internet contact with respondent. Through her mother, Lauren met three other men in the same way.
Lauren’s mother Jill was ultimately convicted and sent to prison in North Carolina for offenses related to abuse of her daughter.
At the request of appellant we have taken judicial notice of a document from the North Carolina Sex Offender & Public Protection Registry that indicates respondent is “registered” as a person who has a “reportable conviction.” This document was not before the trial court.
Section 290 reads, in pertinent part: “(a)(1)(A) Every person described in paragraph (2), for the rest of his or her life while residing in California, or while attending school or working in California, as described in subparagraph (G), shall be required to register with the chief of police of the city in which he or she is residing, or the sheriff of the county if he or she is residing in an unincorporated area or city that has no police department, and, additionally, with the chief of police of a campus of the University of California, the California State University, or community college if he or she is residing upon the campus or in any of its facilities, within five working days of coming into, or changing his or her residence within, any city, county, or city and county, or campus in which he or she temporarily resides. [IQ ... HQ
“(2) The following persons shall be required to register pursuant to paragraph (1): [ft] .. . [ft]
“(D)(i) Any person who, since July 1, 1944, has been, or is hereafter convicted in any other court, including any state, federal, or military court, of any offense that, if committed or attempted in this state, would have been punishable as one or more of the offenses described in subparagraph (A), including offenses in which the person was a principal, as defined in Section 31.
“(ii) Any person ordered by any other court, including any state, federal, or military court, to register as a sex offender for any offense, if the court found at the time of conviction or sentencing that the person committed the offense as a result of sexual compulsion or for purposes of sexual gratification.
“(iii)(I) Except as provided in subclause (II), any person who would be required to register while residing in the state of conviction for a sex offense committed in that state, [ft] (It) Notwithstanding subclause (I), a person convicted in another state of an offense similar to one of the following offenses who is required to register in the state of conviction shall not be required to register in California unless the out-of-state offense contains all of the elements of a registerable California offense described in subparagraph (A): HI] (aa) Indecent exposure, pursuant to Section 314. [ft] (ab) Unlawful sexual intercourse, pursuant to Section 261.5. [ft] (ac) Incest, pursuant to Section 285. [ft] (ad) Sodomy, pursuant to Section 286, or oral copulation, pursuant to Section 288a, provided that the offender notifies the Department of Justice that the sodomy or oral copulation conviction was for conduct between consenting *71adults, as described in subparagraph (G) and the department is able, upon the exercise of reasonable diligence, to verify that fact, [f] (ae) Pimping, pursuant to Section 266h, or pandering, pursuant to Section 266i.
“(B) Any person ordered by any court to register pursuant to this section for any offense not included specifically in this section if the court finds at the time of conviction or sentencing that the person committed the offense as a result of sexual compulsion or for purposes of sexual gratification. The court shall state on the record the reasons for its findings and the reasons for requiring registration.”
We will refer to the San Francisco District Attorney’s Office as the “District Attorney” and the California Attorney General’s Office as the Attorney General or appellant.
Other than a denial that respondent “is being ‘unlawfully’ restrained,” and a general assertion of “no proof of custody,” we have found nothing in the record to indicate that the District Attorney or the Attorney General raised an objection that the petition for writ of habeas corpus was an incorrect remedy.
We note that respondent moved twice to continue the hearing on his petition and the record does not indicate that the Attorney General was given notice of the continuances.
“ ‘The Attorney General,... is the chief law officer of the state (Cal. Const., art. V, § 13). As such he possesses not only extensive statutory powers but also broad powers derived from the common law relative to the protection of the public interest. [Citations.] “[H]e represents the interest of the people in a matter of public concern.” [Citation.] Thus, “in the absence of any legislative restriction, [he] has the power to file any civil action or proceeding directly involving the rights and interests of the state, or which he deems necessary for the enforcement of the laws of the state, the preservation of order, and the protection of public rights and interest.” [Citation.] Conversely, he has the duty to defend all cases in which the state or one of its officers is a party. (Gov. Code, § 12512.)’ {D’Amico v. Board of Medical Examiners (1974) 11 Cal.3d 1, 14-15 [112 Cal.Rptr. 786, 520 P.2d 10]; Kilgore v. Younger (1982) 30 Cal.3d 770, 784-785 [180 Cal.Rptr. 657, 640 P.2d 793]; State Board of Pharmacy v. Superior Court (1978) 78 Cal.App.3d 641, 644—645 [144 Cal.Rptr. 320].)” {California Air Resources Bd. v. Hart (1993) 21 Cal.App.4th 289, 295 [26 Cal.Rptr.2d 153].)
Section 1473 reads in full: “(a) Every person unlawfully imprisoned or restrained of Ms liberty, under any pretense whatever, may prosecute a writ of habeas corpus, to inquire into the cause of such imprisonment or restraint. [][] (b) A writ of habeas corpus may be prosecuted for, but not limited to, the following reasons: [][] (1) False evidence that is substantially material or probative on the issue of guilt or puMshment was introduced against a person at any hearing or trial relating to his incarceration; or [][] (2) False physical evidence, believed by a person to be factual, probative, or material on the issue of guilt, which was known by the person at the time of entering a plea of guilty, wMch was a material factor directly related to the plea of guilty by the person, [f] (c) Any allegation that the prosecution knew or should have known of the false nature of the evidence referred to in subdivision (b) is immaterial to the prosecution of a writ of habeas corpus brought pursuant to subdivision (b). [f] (d) Nothing in this section shall be construed as limiting the grounds for wMch a writ of habeas corpus may be prosecuted or as precluding the use of any other remedies.”
Respondent acknowledges that his “writ petition did not attack the validity of his conviction or the validity of actual or constructive custody,” and thus “was an incorrect remedy altogether.”
Particularly section 290, subdivision (a)(2)(D)(i) and (iii).