An essential element of habeas corpus relief is custody of the petitioner, either physical or constructive. A person is in custody constructively if he may later lose his liberty and be eventually incarcerated such as a parolee, probationer, or person released on his own recognizance or bail. On appeal a habeas petition may be considered to be a petition for writ of mandate where an allegation is made of an act committed in excess of jurisdiction, the issue presented is purely legal in nature, and there is no need for an evidentiary hearing. Petitioner received relief in the trial court from a 290 registration obligation stemming from an out of state conviction. The 290 registration resulted in revocation of petitioner’s license to practice medicine. Because of policy considerations, the Attorney General was not estopped from objecting on appeal, even though the district attorney had withdrawn its opposition in the superior court and the Attorney General failed to appear for the trial court hearing. Stier, not being in custody, was not entitled to habeas relief. Due to the inadequate record, the appellate court was unable to consider a petition for mandate.