
23 Cal.Rptr.3d 204 (2004)
125 Cal.App.4th 623
Rotonda Lanique FULLER, Petitioner,
v.
The SUPERIOR COURT of Los Angeles County, Respondent;
The People, Real Party in Interest.
No. B176343.
Court of Appeal, Second District, Division 4.
December 27, 2004.
As Modified January 5, 2005.
Michael P. Judge, Public Defender of Los Angeles County, Lloyd Handler, and John Hamilton Scott, Deputy Public Defenders for Petitioner.
No appearance for Respondent.
Steve Cooley, District Attorney for Los Angeles County, Patrick D. Moran and Brent Riggs, Deputy District Attorneys for Real Party in Interest.
Certified for Partial Publication.[*]
EPSTEIN, P.J.
Rotonda Lanique Fuller challenges the superior court's handling of, and denial of, her petition for writ of habeas corpus *205 after the same judge, acting as a magistrate, denied her motion to dismiss a misdemeanor complaint for loitering. We conclude that the practice of assigning a habeas corpus petition on a misdemeanor complaint to the same judge who has denied a motion to dismiss is improper. The petition is granted.

FACTUAL AND PROCEDURAL SUMMARY
Petitioner was charged with misdemeanor loitering with intent to commit prostitution, a violation of Penal Code section 653.22, subdivision (a) (all further statutory references are to the Penal Code unless otherwise indicated). The police report stated that Downey police officers Pellerin and Brown were on patrol in April 2004, focusing on prostitution activity in the area of Long Beach Boulevard and Missouri Avenue. Officer Pellerin observed petitioner walking eastbound on Missouri Avenue in front of the La Siesta Motel with a man later identified as Victor Alvarez. Although the temperature was in the mid-50's, and other people in the area were wearing jackets, petitioner was wearing a low-cut shirt exposing a large portion of her breasts. Officer Pellerin contacted petitioner and Alvarez and separated them. Alvarez told Officer Pellerin he had just rented a room at the motel and had offered petitioner $40 to have sexual intercourse.
Officer Brown spoke with petitioner. She said she had just met Alvarez at the corner of Long Beach and Missouri and was walking with him toward the motel room. She said he was holding a room key and $40. Petitioner admitted that she previously had worked as a prostitute, and had been arrested for that offense three weeks before. She gave Officer Brown permission to look in her purse. He did, and found two condoms and a mobile telephone. He arrested her for loitering with intent to commit prostitution.
Petitioner moved to have the complaint dismissed or to be released from custody pursuant to section 991. Petitioner's counsel argued that, since she was walking toward a destination when arrested and was not walking back and forth in front of the location where the arrest took place, loitering could not be established. Based on pending bench warrants for petitioner and her prior convictions for loitering or prostitution, the district attorney opposed release. The magistrate denied the motion and petitioner entered a plea of not guilty.
Petitioner then filed a petition for writ of habeas corpus in the superior court. The petition was assigned to the same trial court judge who had denied the section 991 motion. The petition was denied. Petitioner then filed a petition for writ of habeas corpus in this court, and we issued an order to show cause deeming it a petition for writ of prohibition.
On July 21, 2004, counsel for petitioner advised us that his client was no longer in custody, having been released from custody pending trial. Counsel argued that this development does not render the petition moot, but suggested that we remand the case to the trial court for hearing by an appropriate judge.
The district attorney did not file a return, but did file a letter brief taking the position that the writ filed in the trial court "amounted to a petition for a writ of mandate and that rule 2.5(a)(1) of the Los Angeles Superior Court Rules required the superior court to transfer the petition for hearing to Department 70 of the Los Angeles Superior Court . . ." The district attorney continued: "We agree with Fuller, in any event, that, in ruling purely as a matter of law on the merits, the superior *206 court should not have assigned the petition to the same judge who ruled on Fuller's motion under Penal Code section 991. Our opinion would be different if the superior court were presented with a habeas petition that potentially required an evidentiary hearing." (Italics in original.)
Upon receipt of the district attorney's letter, counsel for petitioner filed another letter brief. Petitioner's counsel contended that the petition was proper for habeas corpus relief rather than mandate and questioned the meaning of the district attorney's suggestion that its position would be different if an evidentiary hearing was required in the trial court. Counsel reiterated his view that the Los Angeles superior Court rules, mandating that a trial court judge review his or her own orders, created a legally infirm procedure.

DISCUSSION

I[**]

II
Both petitioner and real party in interest agree that it is improper for a trial court judge who has ruled on a motion under section 991 to then review the propriety of that ruling on a petition for writ of habeas corpus. The Los Angeles Superior Court rules (all references to rules are to these rules unless otherwise indicated) draw a distinction between petitions for writ of habeas corpus filed in conjunction with an appeal pending in the Appellate Division of the Superior Court, and petitions for writ of habeas corpus with no related appeal pending. Rule 2.5(a)(2) provides: "Each judge assigned to the Appellate Division is also assigned to Department 70 of the Central District, . . . Petitions for writ of habeas corpus that are properly filed in conjunction with an appeal pending in the Appellate Division shall be heard by one judge, assigned on a rotating basis, from those judges sitting in Department 70."
Rule 6.32, governing petitions for habeas corpus, reiterates this distinction: "(a) A petition for a Writ of Habeas Corpus shall be filed in the office of the Clerk of the Court and promptly presented as follows: [¶] (1) To the Judge in the department or division where the person or subject matter involved in the writ application is pending; [¶] (2) In all other cases, [¶] (a) to the Supervising Judge of the Criminal Division of the Central District if the case was heard or is pending in the Central District; or [¶] (b) to the Supervising Judge of the District where the case was heard or is pending; ... [¶] (b) This rule does not apply to a petition for Writ of Habeas Corpus filed in conjunction with an appeal from a misdemeanor or infraction case. The petition for Writ of Habeas Corpus filed in conjunction with an appeal must be filed in Department 70. ..." (Italics added.)
The practice of assigning petitions for writs of habeas corpus to the trial court judge whose ruling is the subject of the petition is improper. Section 859c, enacted as part of the legislation to facilitate unification of the superior and municipal courts in 1998, provides: "Procedures under this code that provide for superior court review of a challenged ruling or order made by a superior court judge or a magistrate shall be performed by a superior court judge other than the judge or magistrate who originally made the ruling or order, unless agreed to by the parties." (Stats.1998, ch. 931, eff.Sept.28, 1998.) The Law Revision Commission Comment to this statute states: "Section 859c is added to accommodate unification of the municipal and superior courts in a county. Cal. Const. art. VI, § 5(e). It preserves the policy of Article VI, Section 23(c)(7) of *207 the Constitution (preserving single judge review of preliminary criminal matters). Cf. Sections 995 (setting aside indictment or information); 1538.5 (motion to suppress).... [28 Cal. L. Rev.Comm. Reports App. 7 (1998]." (Cal. Law Revision Com.com., 50 West's Ann. Pen.Code (2004 supp.) foll. § 859c, p. 205.)
The Los Angeles Superior Court practice runs afoul of section 859c and is improper. In re Ramirez (2001) 89 Cal. App.4th 1312, 108 Cal.Rptr.2d 229, does not compel a different result. In that case, the issue was whether, in the wake of trial court unification, a habeas corpus petition arising out of a misdemeanor case may be filed directly in the Court of Appeal, as opposed to the trial court. Ramirez argued that he properly petitioned the Court of Appeal for habeas corpus in the first instance because, under unification, there is but one trial court and it is impermissible for one superior court judge to overrule another. (Id. at p. 1313, 108 Cal.Rptr.2d 229.) The ground for the habeas corpus petition was Ramirez's argument that the superior court was attempting to enforce probationary conditions after probation had expired by operation of law because he had been on probation for a longer period than the maximum term permitted for the crime. (Id. at p. 1314, 108 Cal.Rptr.2d 229.)
The People argued that the habeas petition should have been filed in department 70 of the Los Angeles Superior Court, because court unification had "not altered the longstanding jurisdictional locus for these misdemeanor matters, particularly where factual issues are involved." (In re Ramirez, supra, 89 Cal.App.4th at p. 1315, 108 Cal.Rptr.2d 229.) After reviewing the history and purposes of trial court unification, the Court of Appeal concluded that pursuant to California Constitution, article VI, section 10, both the Courts of Appeal and the superior court have original jurisdiction in habeas corpus proceedings. (Id. at pp. 1316, 1318, 108 Cal.Rptr.2d 229.)
Examining rule 2.25(a), the Ramirez court concluded that the assignment of writs of habeas corpus challenging detention arising out of a misdemeanor "comports with article VI, section 10 of the California Constitution, which vests superior courts and their judges with original jurisdiction in habeas corpus proceedings." (In re Ramirez, supra, 89 Cal.App.4th at p. 1320, 108 Cal.Rptr.2d 229.)
In this case, the petition for habeas corpus was assigned not to department 70, but to the trial court judge who had denied the motion to dismiss, under rule 6.32(a)(1). This was improper. The district attorney concurs, agreeing that the petition should not have been assigned to the same judge who ruled on the motion to dismiss. The petition is granted.

DISPOSITION
The petition for writ of prohibition is granted.
We concur: HASTINGS and CURRY, JJ.
NOTES
[*]   Pursuant to California Rules of Court, rules 976(b) and 976.1, this opinion is certified for publication with the exception of section I of the discussion.
[**]   See footnote *, ante.
