
120 Cal.App.3d 877 (1981)
174 Cal. Rptr. 820
THE PEOPLE, Plaintiff and Respondent,
v.
JOE PACINI, Defendant and Appellant.
Docket No. 10925.
Court of Appeals of California, Third District.
June 24, 1981.
*880 COUNSEL
Richard W. Phelan for Defendant and Appellant.
George Deukmejian, Attorney General, Robert H. Philibosian, Chief Assistant Attorney General, Arnold O. Overoye, Assistant Attorney General, Eddie T. Keller and Thomas D. McCrackin, Deputy Attorneys General, for Plaintiff and Respondent.
OPINION
BLEASE, J.
We are asked to decide whether the term of commitment of a patient to a state mental hospital (Pen. Code, § 1026) may be extended pursuant to Penal Code section 1026.5 by proceedings initiated by a petition filed after the expiration of the existing term. We hold that it may not and reverse the trial court's order extending the commitment of defendant Joe Pacini.

FACTS
Joe Pacini, now 74 years of age, was committed to Atascadero State Hospital on January 6, 1976, after having been found not guilty by reason of insanity of voluntary manslaughter. (Pen. Code, §§ 192, subd. 1, 1026.) On June 28, 1979, in accordance with the mandate of In re Moye (1978) 22 Cal.3d 457 [149 Cal. Rptr. 491, 584 P.2d 1097], the Community Release Board (now Board of Prison Terms) set a maximum commitment date of March 11, 1980, for Pacini.
*881 On October 29, 1979, the Director of Forensic Services of the Department of Mental Health wrote to the San Joaquin County District Attorney requesting that he file a petition to extend Pacini's commitment. The letter was either lost or never received. When the district attorney failed to respond by February 21, 1980, the Medical Director of Atascadero telephoned the district attorney and advised one of the deputies that Pacini soon would be returned to Stockton to be released.
The district attorney took no action until March 10, the day before Pacini was to be released. He then obtained, without benefit of statutory authority and without filing a Penal Code section 1026.5 petition, an order from the San Joaquin Superior Court directing that Pacini be returned to court "so that further legal proceedings may be had" relating to Penal Code section 1026.
On the same day, he initiated civil commitment proceedings under the Lanterman-Petris-Short (LPS) Act by securing a 72-hour hold. (Welf. & Inst. Code, § 5150.) When that expired he obtained a certification that Pacini undergo 14 days of involuntary treatment at Atascadero. (Welf. & Inst. Code, § 5250.) Thereupon, the San Joaquin Superior Court suspended its order for further section 1026 proceedings and had Pacini transferred to Atascadero for LPS treatment. There, in the San Luis Obispo Superior Court, postcertification proceedings under LPS were initiated. (Welf. & Inst. Code, § 5303.)
After a hearing on April 10, 1980, the LPS petition was denied based on the finding that Pacini had not "threatened, attempted, or inflicted physical harm upon the person of another after having been taken into custody" pursuant to the LPS proceedings. (Welf. & Inst. Code, § 5300, subd. (a).) Notwithstanding this decision, the court remanded Pacini to Atascadero "for its determination as to whether there are any other grounds requiring it to hold him."
One day earlier, April 9, the San Joaquin County District Attorney obtained another order for the return of Pacini, conditioned on the denial of the LPS petition in San Luis Obispo County. Pacini was delivered to Stockton State Hospital. On April 14, Pacini was certified for another 14 days of LPS treatment. (Welf. & Inst. Code, § 5250.)
On April 17, 1980, over five weeks after the expiration of Pacini's maximum commitment date, the San Joaquin County District Attorney filed a petition to extend his commitment pursuant to Penal Code section *882 1026.5. The next day, the superior court upheld the late filing of the petition on the ground that the statutory time limits in section 1026.5 were not "jurisdictional."
On May 21, 1980, after a trial that lasted several days, the jury returned special verdicts against defendant, finding that (1) he had a "mental disease, defect, or disorder"; (2) by reason thereof, he "represent[ed] a substantial danger of physical harm to others"; and (3) he could be "benefitted from [sic] psychiatric treatment in a state mental hospital." (Pen. Code, § 1026.5, subd. (b)(1).) Pacini was then recommitted to Atascadero State Hospital for a two-year extended term. He appeals from the order of commitment.

I
Pacini contends that the district attorney's failure to timely file the petition required by Penal Code section 1026.5 deprived the trial court of jurisdiction to extend his commitment.
(1a) At the outset, the People urge us not to consider this contention on the ground that it has been resolved against Pacini by the Fifth District Court of Appeal which summarily denied his petition for a writ of habeas corpus by an order issued (July 18, 1980) after the notice of appeal was filed in this case (June 23, 1980). They claim it establishes the law of the case. At the People's request, we take judicial notice of Pacini's petition, the Attorney General's opposition and the minute order denial of the writ. (Evid. Code, §§ 452, subd. (d), 459, subd. (a); People v. Preslie (1977) 70 Cal. App.3d 486, 492-495 [138 Cal. Rptr. 828].) Although the one-sentence denial of the petition recites that it is "upon [the] merits" of Pacini's petition, we reject the People's argument that it must be treated as the law of the case.
The People argue, by implied analogy to cases involving the prerogative writs of mandate and prohibition, that the decision of the Fifth District is binding upon us because the issue here considered was presented to and determined by the court (People v. Shuey (1975) 13 Cal.3d 835, 842 [120 Cal. Rptr. 83, 533 P.2d 211]) by a written opinion (Price v. Civil Service Com. (1980) 26 Cal.3d 257, 267, fn. 5 [161 Cal. Rptr. 475, 604 P.2d 1365].)
(2) "Normally the doctrine of the law of the case requires adherence to an appellate court's statement in its opinion on appeal of a rule of *883 law necessary to its decision. (Tally v. Ganahl (1907) 151 Cal. 418, 421 [90 P. 1049].) The doctrine has been extended to opinions of an appellate court in original proceedings which are equivalent to an intermediate appeal. (Guardianship of Walters (1947) 81 Cal. App.2d 684, 685 [184 P.2d 684]; People v. Vega [(1970]) 12 Cal. App.3d 970, 972 [91 Cal. Rptr. 167].) The doctrine has also been applied to a minute order denial of a motion to dismiss an appeal when the sole question presented by the motion was the appealability of the judgment. (Pigeon Point Ranch, Inc. v. Perot (1963) 59 Cal.2d 227, 231 [28 Cal. Rptr. 865, 379 P.2d 321].)" (People v. Medina (1972) 6 Cal.3d 484, 491, fn. 7 [99 Cal. Rptr. 630, 492 P.2d 686].) "Application of the rule is now subject to the qualifications that `the point of law involved must have been necessary to the prior decision, that the matter must have been actually presented and determined by the court, and that application of the doctrine will not result in an unjust decision.' (Pigeon Point Ranch, Inc. v. Perot (1963) 59 Cal.2d 227, 231 [28 Cal. Rptr. 865, 379 P.2d 321]; see also People v. Medina (1972) 6 Cal.3d 484, 491, fn. 7 [99 Cal. Rptr. 630, 492 P.2d 686].)" (People v. Shuey, supra, 13 Cal.3d at p. 842.)
Critical to the application of the doctrine is the procedure by which the determination of the issue of law is made. On this point, the unique procedures of habeas corpus proceedings come into play.
(3) Habeas corpus proceedings differ procedurally from prerogative writ proceedings. Issues are joined by the issuance of the writ or order to show cause and the return to the writ or order. (Pen. Code, § 1484; Witkin, Cal. Criminal Procedure (1963) § 825, pp. 790-791; In re Lewallen (1979) 23 Cal.3d 274, 277-278 [152 Cal. Rptr. 528, 590 P.2d 383]; In re Saunders (1970) 2 Cal.3d 1033, 1047 [88 Cal. Rptr. 633, 472 P.2d 921].) The petition serves two principal purposes. First, it is an application for a writ. (Pen. Code, § 1474.) "The function of the petition is to secure the issuance of the writ, and when the writ is issued, the petition has accomplished its purpose." (In re Collins (1907) 151 Cal. 340, 342 [90 P. 827, 91 P. 397].)[1] Second, it establishes the *884 "grounds of illegality." (Italics added.) The return must be "responsive to the grounds actually presented in the petition." (People v. Green (1980) 27 Cal.3d 1, 43, fn. 28 [164 Cal. Rptr. 1, 609 P.2d 468], relying on In re Connor (1940) 16 Cal.2d 701, 711 [108 P.2d 10].)[2] But, the return to the writ or order to show cause functions analogously "`to a complaint in a civil proceeding'" in asserting grounds of legality and "as to any factual allegations it makes." (Green, 27 Cal.3d at p. 43, fn. 28.) The petition functions as an answer to the return "where by stipulation or acquiescence it is treated as a traverse [citation]...." (In re Saunders, supra, 2 Cal.3d at p. 1047.) The issuance of the writ or order to show cause "is not equivalent to a final appellate court decision of questions of law in favor of petitioner under the doctrine of law of the case. [Citations.]" (In re Hochberg (1970) 2 Cal.3d 870, 876, fn. 4 [87 Cal. Rptr. 681, 471 P.2d 1]; see also In re Orosco (1978) 82 Cal. App.3d 924, 927 [147 Cal. Rptr. 463].)
The petition for a writ of habeas corpus is thus preliminary in nature. Unlike the petition for a prerogative writ, there is no formal procedure by which it may be contested. (Cf. Code Civ. Proc., § 1107.) Its grant does not establish the law of the case. Nor should its denial.
(4) The procedure by which issues are formally joined in a habeas corpus proceeding results, in the appellate courts, in the creation of cause triggering the state constitutional requirement that it be resolved "in writing with reasons stated." "Once an order to show cause or alternative writ issues, ... the matter becomes a `cause,' pursuant to the California Constitution (art. VI, § 14) and requires a written opinion." (In re Mazoros (1977) 76 Cal. App.3d 50, 52-53 [142 Cal. Rptr. 609].) The creation of the cause also gives the People a right to reply to the petition by a return and to otherwise participate in the decision-making process. As the court in People v. Getty (1975) 50 Cal. App.3d 101, 111 [123 Cal. Rptr. 704], observed: "In the instant case, the procedural requirements concerning writs of habeas corpus were not met. No writ was actually issued, and the People were deprived of their right to be heard by way of a return to any writ granted."
The importance of a written opinion as a prerequisite to a decision sufficiently matured to determine a law of the case has been emphasized in both prerogative and habeas corpus writ cases.
*885 In People v. Medina, supra, 6 Cal.3d 484, the court said that the summary denial of a petition for a prerogative writ is not a "determination of a `cause' requiring oral argument and a written opinion." (Id., at pp. 489-490; see Pen. Code, § 1254; Cal. Rules of Court, rules 22, 30 [right to present oral argument]; Cal. Const., art. VI, § 14 ["Decisions of the Supreme Court and courts of appeal that determine causes shall be in writing with reasons stated."].) It expressed concern that an application of the law of the case doctrine to a summary denial would permit appellate courts to "evade the state constitutional requirement of written opinions" and discourage "well-advised" defendants from seeking relief by writ for fear of losing these "[i]mportant incidents of the right to appeal...." (Medina, 6 Cal.3d at pp. 489-490; see also Price v. Civil Service Com., supra, 26 Cal.3d at p. 267, fn. 5.)
In People v. Getty, supra, 50 Cal. App.3d at pages 106-107, footnote 3, and Rosato v. Superior Court (1975) 51 Cal. App.3d 190, 230-231, these concerns led courts to refuse to consider summary denials of writs as establishing the law of the case, even though they were accompanied by brief explanatory comments which went beyond mere recitations that the denials were on the merits, because the explanations did not amount to formal opinions and the "important" right to present oral argument was not afforded the petitioners. (See also People v. Brigham (1979) 25 Cal.3d 283, 287 [157 Cal. Rptr. 905, 599 P.2d 100] [citing the above cases with apparent approval in connection with holding that criminal defendants have a right to oral argument on appeal].)[3]
The importance of formally joining issues and thus creating a "cause" can be seen in this case. In his petition, Pacini challenged his continued confinement at Atascadero as without legal authority, claiming a violation of the 90-day and 30-day petition and hearing provisions of the mentally disordered sex offender law (Welf. & Inst. Code, § 6316.2, subds. (b) and (d)) which Moye said (22 Cal.3d at p. 467) must be used to constitutionally sustain an extended commitment pursuant to Penal Code section 1026. In the petition Pacini said that he intended to *886 appeal from any order of extended commitment.[4] The People filed an informal, though extensive, opposition to the petition, alleging factual matters and attaching court and hospital documents. The opposition said that Pacini's reliance on Moye was misplaced because Moye has been replaced by Penal Code section 1026.5. It argued further that the petition ought not to be granted on procedural (e.g., appeal as an adequate remedy) and substantive grounds essentially identical to those presented here on appeal. If the opposition had been a return to a writ, it would have tendered new grounds for the legality of the Pacini commitment to be controverted by a traverse. Pacini did not respond to the informal opposition (there was no formal procedure by which to do so) and so never joined issue with the People on the section 1026.5 claims. Moreover, the opposition did not address the specific language of 1026.5, subdivision (b), which we find dispositive of the merits.
Without an opinion it is not possible to determine what merits were resolved by the Fifth District decision. If the court resolved the legal issue tendered in the petition, the only document formally before it, its decision was limited to whether Pacini was entitled to relief pursuant to Moye. (See People v. Green, supra, 27 Cal.3d at p. 43, fn. 28.) That issue is resolved against Pacini "upon [the] merits" solely on the ground that Moye had been supplanted by Penal Code section 1026.5, without reaching the further ground, whether section 1026.5 itself precluded extended commitment. (5) "The doctrine of the law of the case does not extend to points of law which might have been but were not presented and determined on a prior appeal. [Citations.]" (DiGenova v. State Board of Education (1962) 57 Cal.2d 167, 179 [18 Cal. Rptr. 369, 367 P.2d 865].)
(1b) If the law of the case precludes our reaching the merits of Pacini's contention that Penal Code section 1026.5 bars an extension of his commitment, the issue will have been concluded against him without affording him the rights to respond to the People's claims and to oral argument and a written opinion incident to an appeal.[5] And we would be deprived of an opinion by which to evaluate the court's reasoning "upon [the] merits." (See, e.g., People v. Scott (1976) 16 Cal.3d 242, 246-247 [128 Cal. Rptr. 39, 546 P.2d 327].)
*887 The doctrine of the law of the case is also conditioned by equitable considerations. "In determining whether the law of the case will control the decision on the subsequent appeal, ... the appellate court should keep in mind that `the doctrine of the law of the case, which is merely a rule of procedure and does not go to the power of the court, has been recognized as being harsh, and it will not be adhered to where its application will result in an unjust decision.' (DiGenova v. State Board of Education (1962) 57 Cal.2d 167, 179....)" (People v. Medina, supra, 6 Cal.3d at p. 492.) It would work a harsh and unjust result to deprive Pacini of an opinion of the merits of his contentions by application of the law of the case to the summary and cryptic denial of his habeas corpus petition. On another occasion it would work an equally harsh result in precluding the right of the People to respond to a petition. (See People v. Getty, supra, 50 Cal. App.3d 101.)
From these pleading and policy considerations we conclude that the summary denial of a writ of habeas corpus petition by an appellate court, without the issuance of a writ or order to show cause and the consequent creation of a "cause" (Cal. Const., art. VI, § 14), is not a decision which can determine the law of the case.

II
The People admit that the San Joaquin County District Attorney utterly failed in this case to comply with the procedure and time limits for filing a petition to extend a commitment under Penal Code section 1026.5.[6] (6a) They maintain, however, that this failure did not deprive the trial court of jurisdiction to entertain the extended commitment proceeding, since the statutory "time limits" are merely *888 "directory." They rely on the rule that "generally, requirements relating to the time within which an act must be done are directory rather than mandatory or jurisdictional, unless a contrary intent is clearly expressed." (Edwards v. Steele (1979) 25 Cal.3d 406, 410 [158 Cal. Rptr. 662, 599 P.2d 1365].) And they argue that, far from evincing a "contrary intent," the Legislature expressly provided in section 1026.5 that "[t]he time limits of this section are not jurisdictional." (Pen. Code, § 1026.5, subd. (a)(2).)
(7) The question whether a statutory provision is mandatory or directory tenders an issue concerning the consequences which follow upon the violation of the provision. "[T]he terms mandatory and directory ... are only descriptive of the effect that it has been decided should be given to a statutory provision...." (2A Sutherland, Statutory Construction (4th ed.) § 57.01, pp. 412-413.) The terms relate to the law of remedies.
As with all issues of statutory construction, first resort must be had to a close analysis of the language of the statute. "Whether a mandatory or directory construction should be given to a statutory provision may often be determined by an expression in the statute of the result that shall follow noncompliance with the provision." (2A Sutherland, supra, § 57.08, p. 423.) "The rule in California and the majority of United States jurisdictions is that when a consequence is enunciated for failing to comply with an act on a given date, that date is deemed to be jurisdictionally mandatory, not directory (Thomas v. Driscoll, 42 Cal. *889 App.2d 23, 27 [108 P.2d 43]; Shaw v. Randall, 15 Cal. 384)." (Ward v. Fremont Unified Sch. Dist. (1969) 276 Cal. App.2d 313, 322 [80 Cal. Rptr. 815].) In Ward the statute directed that a teacher not given a notice of layoff by a date certain must be reemployed. Here, as will be shown, the statute permits extended commitment "only" upon the filing of a petition prior to the date certain, i.e., the date of expiration of the existing commitment.
Penal Code section 1026.5 is a legislative response to the Supreme Court's decision in In re Moye, supra, 22 Cal.3d 457, which held on equal protection grounds that a person committed to state hospitals following his acquittal of criminal charges on the ground of insanity cannot be retained beyond the maximum term of imprisonment prescribed for the underlying offenses, except, "`[t]o the extent practicable, and in the absence of further legislation,'" by following the extended commitment procedures provided for mentally disordered sex offenders under Welfare and Institutions Code section 6316.2. The Moye decision "carefully selected a structure to protect both individual and public rights." (People v. Balderas (1980) 104 Cal. App.3d 942, 946, 947 [164 Cal. Rptr. 275].)
Section 1026.5, subdivision (b)(1), provides that "[a] person may be committed beyond the term prescribed by subdivision (a) only under the procedure set forth in this subdivision...." (Italics added.) It is clear that whatever "procedure" refers to, it is mandatory in the sense that without compliance with the "procedure" no "person may be committed beyond the [existing] term." An inspection of the section shows two references for "procedure." The first is the general "procedure" which includes the filing of a petition "before the expiration of the original commitment." (Italics added.) (Subd. (b)(2).) The centrality of this procedural requirement is emphasized in the case of a subsequent recommitment which may be instituted only by the filing of a petition "[p]rior to termination of a commitment under this subdivision...." (Subd. (b)(8).)[7] The second "procedure" is the "time limits" specified for the filing of the petition and the initiation of the trial.
*890 The People rely upon the provisions of subdivision (a)(2) which provides that "[t]he time limits of this section are not jurisdictional."[8] (Italics added.) In effect, the People claim that this provision encompasses both of the above senses of "procedure." This claim has the impermissible result, however, of completely nullifying the mandatory direction that the "procedure" be followed before expiration of the term.
We must, of course, read the language of a statute, if possible, so as not to render some portion of it meaningless. That task can readily be accomplished here. The provision relied upon is in a subsection ((a)(2)) which contains time limits not here in issue. It directs the Board of Prison Terms to set a maximum term of commitment, for any person who had been committed under the prior indeterminate provision of Penal Code section 1026, "within 90 days of the date the person is received by the state hospital, or of September 28, 1979, whichever is later...." and inform various persons of the decision within 20 days. The immediate contextual reference of the language of (jurisdictional) limitation is to these provisions. Only by reading the term "section" as inclusive of subsection (b)(2) does the People's claim have any merit.
But a contextual reading of "this section" limits its application to the time limits of subsection (a)(2). We first observe that the term "section" in (a)(2) is unambiguously used to refer only to subsection (a)(2) in the sentence immediately following that under review.[9] Second, the natural reference of the words of jurisdictional limitation is to the immediate context in subsection (a)(2) which contains "time limits." We conclude that "this section" refers to subsection (a)(2) and does not affect subsection (b)(2).[10]
*891 Accordingly, there is no express jurisdictional limitation upon the "procedure" which is made mandatory by subsection (b)(2). Because, on either ground considered above, this case must be decided in favor of Pacini, we need not resolve whether or under what conditions a violation of the "time limits" of (b)(2) is jurisdictional.
As an alternative ground of resolution, assuming that the word "section," as used in subsection (a)(2), encompasses subsection (b)(2), we are still compelled to reconcile the mandatory "procedure" of (b)(2) with the jurisdictional limitation on "time limits" in (a)(2). That can be done by limiting the jurisdictional language of (a)(2) to its precise reference, that is, to "time limits," and hence to limit the term "procedure" to its first sense as discussed above. That leaves the first sense of "procedure" in (b)(2), that is, the requirement that the petition be filed before expiration of the term of commitment, in (b)(2), with its full jurisdictional effect.
The time limits in subsection (b)(2) are unquestionably intended to afford a patient notice of and an opportunity to prepare for a trial to be completed before expiration of the existing term of commitment. (Pen. Code, § 1026.5, subd. (b)(4).) Compliance with these provisions spares patients a possibly painful choice between seeking an expeditious trial and presenting a complete defense. If a patient is successful in this defense, he is also spared a commitment longer than his existing term. Obviously, not every failure to comply with the "time limits" would compromise the patient's liberty interest. But we need not reach the issue whether the precise "time limits" of subsection (b)(2) are within the term "procedure" and hence are jurisdictional.
(6b) In the present case the petition was not filed until over five weeks after the expiration of Pacini's previous commitment and he was kept confined thereafter by a combination of orders for unspecified "further proceedings," a series of civil commitments and, finally, custodial orders issued under the aegis of Penal Code section 1026.5.[11] There was consequently a failure to comply with the requirement that the petition be filed before expiration of the commitment. We hold that the term "procedure" in subdivision (b)(2) encompasses at least that requirement and that the failure to comply is jurisdictional.[12]
*892 We are compelled by statute to hold that the trial court lacked jurisdiction to accept the belated petition and to extend Pacini's commitment under Penal Code section 1026.5.
The judgment is reversed.
Puglia, P.J., and Carr, J., concurred.
A petition for a rehearing was denied July 22, 1981, and the opinion was modified to read as printed above. Respondent's petition for a hearing by the Supreme Court was denied September 10, 1981.
NOTES
[1]  We note that, although no issue of res judicata is tendered in this case and is not before us (Pillsbury v. Superior Court (1937) 8 Cal.2d 469, 472 [66 P.2d 149]), "a determination that the allegations of a petition are insufficient to warrant issuance of the writ is not a ruling on the merits of the issues which the petitioner has attempted to raise, and does not preclude the filing of a new petition which meets the essential requirements." (36 Cal.Jur.3d, Habeas Corpus, § 52, Res Judicata, p. 90, citing to In re Swain (1949) 34 Cal.2d 300 [209 P.2d 793]; see also In re Richard M. (1975) 14 Cal.3d 783 [122 Cal. Rptr. 531].)
[2]  The return may, of course, "`set up any authority or cause for the petitioner's imprisonment and restraint.'" (People v. Green, supra, 27 Cal.3d 1, 43, fn. 28, relying on In re Cleaver (1968) 266 Cal. App.2d 143, 156 [72 Cal. Rptr. 20].)
[3]  This analysis is not inconsistent with Pigeon Point Ranch, Inc. v. Perot (1963) 59 Cal.2d 227 [28 Cal. Rptr. 865, 379 P.2d 321]. That decision applied the law of the case doctrine to a minute order denial of a motion to dismiss an appeal, giving it conclusive effect as to the appealability of the underlying judgment. (People v. Medina (1972) 6 Cal.3d 484, 491 [99 Cal. Rptr. 630, 492 P.2d 686].) It was clear, however, that no injustice could result thereby, since the decision was in aid of appellate review. (Pigeon Point Ranch Inc. v. Perot, supra, 59 Cal.2d at pp. 231-232; see also Richer v. Superior Court (1976) 63 Cal. App.3d 748, 755-758 [134 Cal. Rptr. 52] [in which invocation of the doctrine facilitated prompt adjudication of the parties' dispute on the merits].)
[4]  The writ petition was filed in anticipation of but apparently without knowledge of the outcome of the extended commitment proceedings.
[5]  "Normally habeas corpus will not lie where the remedy of appeal exists. (In re Lopez (1970) 2 Cal.3d 141, 151 [84 Cal. Rptr. 361, 465 P.2d 257]; In re Dixon (1953) 41 Cal.2d 756, 760-761 [264 P.2d 513].)" (In re Brown (1973) 9 Cal.3d 679, 682 [108 Cal. Rptr. 801, 511 P.2d 1153]; and see In re Crow (1971) 4 Cal.3d 613, 622, fn. 9 [94 Cal. Rptr. 254, 483 P.2d 1206]; cf. 36 Cal.Jur.3d, supra, § 26, p. 48.) Pacini's petition could have been denied on the ground that this appeal was pending, as was urged upon the court by the People. By an ironic turn of events, the denial of the petition is now made a ground for denial of the preferred right of appeal.
[6]  Subdivision (a) of Penal Code section 1026.5 provides for the calculation of a defendant's maximum term of commitment. Subdivision (b) sets out a procedure for extending commitments in two-year increments. At the time of trial, the subdivision contained the following pertinent provisions:

"(b) (1) A person may be committed beyond the term prescribed by subdivision (a) only under the procedure set forth under this subdivision and only if such person has been committed under Section 1026 for [a violent felony enumerated therein (the list has since been deleted from section 1026 and added to section 1026.5, subdivision (a) (Stats. 1980, ch. 547, §§ 1, 6, ch. 1117, § 6.1))] and who by reason of a mental disease, defect, or disorder represents a substantial danger of physical harm to others.
"(2) If during a commitment, the medical director of a state hospital or other treatment facility has good cause to believe that a patient is a person described in paragraph (1), the director may submit such supporting evaluations and case file to the prosecuting attorney who may file a petition for extended commitment in the superior court which issued the original commitment. Such petition shall be filed no later than 90 days before the expiration of the original commitment. Such petition shall state the reasons for the extended commitment, with accompanying affidavits specifying the factual basis for believing that the person meets each of the requirements set forth in paragraph (1).
".... .... .... .... . .
"(4) The court shall conduct a hearing on the petition for extended commitment. The trial shall be by jury unless waived by both the person and the prosecuting attorney. The trial shall commence no later than 30 days prior to the time the person would otherwise have been released, unless such time is waived by the person.
".... .... .... .... . .
"(6) If the court or jury finds that the person is a person described in paragraph (1), the court may order the patient recommitted to the facility in which he was confined at the time the petition was filed for an additional period of two years from the date of termination of the previous commitment." (Italics added.)
[7]  "(8) Prior to termination of a commitment under this subdivision, a petition for recommitment may be filed to determine whether the person remains a person described in paragraph (1). Such recommitment proceeding shall be conducted in accordance with the provisions of this subdivision." We can perceive no statutory policy which would treat the first extended commitment different than a second or subsequent extended commitment.
[8]  "(a)(2) In the case of a person committed to a state hospital or other facility pursuant to Section 1026 or 1026.1, who committed a felony prior to July 1, 1977, and who could have been sentenced under Section 1168 or 1170 if the offense was committed after July 1, 1977, the Community Release Board shall determine the maximum term of commitment which could have been imposed under paragraph (1) and the person may not be kept in actual custody longer than the maximum term of commitment, except as provided in subdivision (b). The time limits of this section are not jurisdictional." (Italics added.)
[9]  "In fixing a term under this section the board shall...." (Italics added.) Since the board only "fixes a term," i.e., sets a maximum term of commitment under subsection (a), "this section" can only mean "subsection."
[10]  That the Legislature did not include words of jurisdictional limitation in subsection (b)(2) while including them in subsection (a)(2) supports this conclusion.
[11]  The use of custodial devices of civil commitment proceedings cannot be used to circumvent the jurisdictional "procedure" of section 1026.5.
[12]  This conclusion is also compelled by policy reasons. Where statutory requirements are intended by the Legislature to provide protection or benefit to individuals, and not merely to serve some collateral, administrative purpose, "`... they are not directory but mandatory. They must be followed or the acts done will be invalid.'" (People v. McGee (1977) 19 Cal.3d 948, 965 [140 Cal. Rptr. 657, 568 P.2d 382], quoting French v. Edwards (1872) 80 U.S. (13 Wall.) 506, 511 [20 L.Ed. 702, 703].) Thus, In re Johnson (1980) 107 Cal. App.3d 780, 784-786 [166 Cal. Rptr. 84], held that the requirement of Penal Code section 1170.2 that a prisoner be afforded a serious offender hearing within 120 days of his receipt by the Department of Corrections was mandatory, and not merely directory. The court found inapposite In re Caudillo (1980) 26 Cal.3d 623 [164 Cal. Rptr. 692, 610 P.2d 1021], which held that the Board of Prison Terms is reinvested with jurisdiction to conduct a serious offender hearing where a judgment entered pursuant to the former Indeterminate Sentence Law has been substantially modified. (Johnson, 107 Cal. App.3d at pp. 786-787.) Similarly, Caudillo, which is relied on by the People, has no application here. This is not a case where the petition came too late because the defendant's term of commitment was modified so that he suddenly became entitled to release; this is a case, rather, where the district attorney simply failed to file a petition before expiration of the term of commitment. Since the legislative purpose behind the procedure required by Penal Code section 1026.5 is to benefit patients, the trial court was without jurisdiction to entertain the late petition.
