
82 Cal.Rptr.2d 712 (1999)
70 Cal.App.4th 434
Justin MALOVEC, a Minor, etc., et al., Plaintiffs,
v.
Charles HAMRELL, Defendant and Respondent;
Bruce G. Fagel, Objector and Appellant.
No. B111152.
Court of Appeal, Second District, Division Five.
March 1, 1999.
*714 Bruce G. Fagel, in pro. per, and James E. Wright for Objector and Appellant.
O'Flaherty, Cross, Martinez, Ovando & Hatton, Robert M. Dato and Brian P. Barrow, Anaheim, for Defendant and Respondent.
GRIGNON, Acting P.J.
After granting defendant's motion for summary judgment, the trial court on its own motion ordered plaintiffs attorney to show cause why sanctions pursuant to Code of Civil Procedure section 128.7[1] should not be imposed for the filing and pursuit of the complaint. Plaintiff filed a voluntary dismissal with prejudice of the complaint. After a hearing, the trial court imposed monetary sanctions against plaintiffs attorney in favor of defendant and the county. We conclude: (1) a trial court may not initiate section 128.7 sanctions against a plaintiff for filing and pursuing a complaint after it has granted a defendant's motion for summary judgment; and (2) a trial court may not award section 128.7 monetary sanctions to an opposing party on its own motion. We reverse.

FACTS AND PROCEDURAL BACKGROUND
Appellant Attorney Bruce Fagel represented minor Justin Malovec and his mother in a medical malpractice action against defendant and respondent Charles Hamrell, M.D. The action arose out of injuries Justin suffered during his birth. Dr. Hamrell was the chief of obstetrics at the hospital where Justin had been born. The Malovecs had previously brought against and settled with the hospital an action arising from the same injuries. The complaint against Dr. Hamrell was filed on March 12, 1996. Dr. Hamrell demurred to the complaint on the ground of the settlement with and release of the hospital. The demurrer was overruled. Dr. Hamrell moved for summary judgment on the same ground. The motion was granted at a hearing held on January 30,1997.
At the hearing on the summary judgment motion, the trial court on its own motion set the matter for an order to show cause hearing on March 6, 1997, as to why section 128.7 sanctions should not be imposed against Attorney Fagel for filing and prosecuting the complaint. On February 27, 1997, prior to the entry of judgment on the complaint, Attorney Fagel filed a request for voluntary *715 dismissal of the action with prejudice. The clerk entered dismissal. Attorney Fagel opposed the sanctions motion on the ground that he had withdrawn the challenged pleading during the 30-day safe harbor period. The trial court found the voluntary dismissal to be ineffective and imposed sanctions against Attorney Fagel in the amount of $10,000 in favor of Dr. Hamrell and in the amount of $10,000 in favor of the County of Los Angeles.
Attorney Fagel filed a timely notice of appeal from the sanctions order.

DISCUSSION
In this case, we examine section 128.7 to determine the limitations applicable to monetary sanctions imposed on the trial court's own motion. We first consider whether a trial court may initiate monetary sanctions following a dispositive ruling on an improper pleading. We next consider whether a trial court on its own motion may award monetary sanctions in favor of a party.

Legislative Intent
"Our obligation in applying section 128.7 is to carry out the Legislature's intent. [Citations.] The words of a statute are the surest indication of the Legislature's intent.... Further, in applying a statute, it may be appropriate to look to its legislative history." (Goodstone v. Southwest Airlines Co. (1998) 63 Cal.App.4th 406, 423, 73 Cal. Rptr.2d 655.)

Statutory Provisions
In cases filed prior to January 1, 1995, a trial court was authorized to impose sanctions pursuant to section 128.5 against a party or the party's attorney for bad faith actions or tactics. "Every trial court may order a party, the party's attorney, or both to pay any reasonable expenses, including attorney's fees, incurred by another party as a result of bad-faith actions or tactics that are frivolous or solely intended to cause unnecessary delay." (§ 128.5, subd. (a).) "`Actions or tactics' include, but are not limited to, the ... filing and service of a complaint...." (§ 128.5, subd. (b)(1).) A concern was raised that these subjective sanctions procedures were ineffective. Therefore, the Legislature revised the procedures for sanctions by enacting section 128.7 in "an effort to largely bring California sanctions practice into line with rule 11 of the Federal Rules of Civil Procedure (28 U.S.C.)" (Goodstone v. Southwest Airlines Co., supra, 63 Cal.App.4th at p. 419, 73 Cal. Rptr.2d 655; Trans-Action Commercial Investors, Ltd. v. Firmaterr, Inc. (1997) 60 Cal.App.4th 352, 368, 70 Cal.Rptr.2d 449.) Section 128.7 is effective for cases filed from January 1, 1995, to January 1, 2003.
Section 128.7[2] requires the attorney for a plaintiff to sign the complaint, representing *716 that after making a reasonable inquiry the complaint has not been filed for any improper purpose, the claims are warranted by existing law or nonfrivolous argument for the extension of existing law, and the allegations have factual support. (§ 128.7, subds. (a) and (b).) After notice and opportunity to be heard, a trial court may impose sanctions against an attorney who has misrepresented the purpose or legal or factual sufficiency of a complaint. There are two procedures which may lead to the imposition of sanctions. First, a party may move for sanctions. (§ 128.7, subd. (c)(1).) Second, the trial court may initiate sanctions on its own motion. "On its own motion, the court may enter an order describing the specific conduct that appears to violate subdivision (b) and directing an attorney, law firm, or party to show cause why it has not violated subdivision (b), unless, within 30 days of service of the order to show cause, the challenged paper, claim, defense, contention, allegation, or denial is withdrawn or appropriately corrected." (§ 128.7, subd. (c)(2).)

The Safe Harbor Provisions
Section 128.7 is very similar to rule 11 of the Federal Rules of Civil Procedure (Rule 11) with a few material differences. Both provisions include a safe harbor period, which permits an offending party to withdraw an improper pleading during a specified period. In the federal rule, the safe harbor period is 21 days, while the California statute prescribes 30 days. In addition, in the federal rule the safe harbor provisions are applicable only to motions by a party, while the California statute applies the safe harbor provisions to a party's motion as well as the *717 court's own motion. (Pacific Trends Lamp & Lighting Products, Inc. v. J. White, Inc. (1998) 65 Cal.App.4th 1131, 1136, 76 Cal. Rptr.2d 918.) In all other respects, the safe harbor provisions of section 128.7 are virtually identical to those of Rule 11. "The effect of federal law is important in terms of applying section 128.7 which contains virtually the same safe harbor provisions as [R]ule 11. This is because the Legislature specifically intended to adopt the [R]ule 11 model with its `safe harbor' provisions." (Goodstone v. Southwest Airlines Co., supra, 63 Cal. App.4th at p. 422, 73 Cal.Rptr.2d 655.)
A party seeking sanctions must follow a two-step procedure. First, the moving party must serve on the offending party a motion for sanctions. Service of the motion on the offending party begins a 30-day safe harbor period during which the sanctions motion may not be filed with the court. During the safe harbor period, the offending party may withdraw the improper pleading and thereby avoid sanctions. If the pleading is withdrawn, the motion for sanctions may not be filed with the court. If the pleading is not withdrawn during the safe harbor period, the motion for sanctions may then be filed. Pursuant to section 128.7, the trial court must follow a similar two-step procedure. The trial court may issue an order to show cause as to why sanctions should not be imposed and set the matter for a hearing at least 30 days after service of the order. The offending party may withdraw the improper pleading during this 30-day period. If the improper pleading is withdrawn, sanctions may not be imposed. If the improper pleading is not withdrawn, the offending party responds to the order to show cause, a hearing is held, and sanctions may be imposed.
The purpose of the safe harbor provisions is to permit an offending party to avoid sanctions by withdrawing the improper pleading during the safe harbor period. (Ridder v. City of Springfield (6th Cir.1997) 109 F.3d 288, 294.) This permits a party to withdraw a questionable pleading without penalty, thus saving the court and the parties time and money litigating the pleading as well as the sanctions request. "[Sanctions under section 128.7 are not designed to be punitive in nature but rather to promote compliance with statutory standards of conduct." (Cromwell v. Cummings (1998) 65 Cal.App.4th Supp. 10, 14, 76 Cal.Rptr.2d 171.)[3]
In order to effectuate the safe harbor provisions, a party may not bring a motion for sanctions unless there is some action the offending party may take to withdraw the improper pleading. (Ridder v. City of Springfield, supra, 109 F.3d at p. 295.) A sanctions motion may not be brought after the conclusion of the case or a dispositive ruling on the improper pleading. (Ibid.) Thus, a sanctions motion challenging a complaint may not be brought following the sustaining of a demurrer without leave to amend. (Cromwell v. Cummings, supra, 65 Cal.App.4th Supp. at p. 13, 76 Cal.Rptr.2d 171.) Nor may a sanctions motion challenging an amendment to a complaint to name Doe defendants be brought following the dismissal with prejudice of the fictitiously named defendants. (Goodstone v. Southwest Airlines, supra, 63 Cal.App.4th at p. 424, 73 Cal.Rptr.2d 655.) Neither may a motion for sanctions for filing a bad faith or frivolous complaint be brought following the granting of a defendant's motion for summary judgment.[4] "Nonetheless, the ... judge found and [defendant] argues that the `safe harbor' provision is rendered a mere `empty formality' when a motion for sanctions comes after summary judgment has been granted. We fully agree with that observation. By virtue of its nature, the `safe harbor' provision cannot have any effect if the court has already rendered its judgment in the case; it is too late for the offending party to withdraw the *718 challenged [pleading]. Given the futility of the `safe harbor' provision in this context, [defendant] deduces that compliance is unnecessary. This is where we depart from [defendant's] logic. Rather than excusing [defendant's] noncompliance, we instead hold that [defendant] has given up the opportunity to receive an award of [section 128.7] sanctions in this case by waiting to file the motion until after the entry of summary judgment. As stated above, a motion for sanctions under [section 128.7] must be served on the offending party for a period of `safe harbor' at least [30] days prior to the entry of final judgment or judicial rejection of the offending contention. A party seeking sanctions must leave sufficient opportunity for the opposing party to choose whether to withdraw or cure the offense voluntarily before the court disposes of the challenged contention." (Ridder v. City of Springfield, supra, 109 F.3d at pp. 296-297.)

Applicability of Safe Harbor Period to Motions by the Court
The law is well settled that the safe harbor provisions preclude a party from seeking monetary sanctions for an offending pleading following a dispositive ruling by the trial court on the pleading. (Goodstone v. Southwest Airlines Co., supra, 63 Cal. App.4th 406, 73 Cal.Rptr.2d 655; Cromwell v. Cummings, supra, 65 Cal.App.4th Supp. 10, 76 Cal.Rptr.2d 171; Barber v. Miller (9th Cir.1998) 146 F.3d 707; Ridder v. City of Springfield, supra, 109 F.3d 288.) The question presented is whether the same limitation is applicable to sanctions initiated by the trial court. We can discern no reason for a different rule. The two safe harbor provisions are substantially the same.
Dr. Hamrell reiterates various policy arguments, which the appellate courts have already rejected in the context of motions brought by a party, as justification for ignoring the safe harbor provisions in the context of motions initiated by the trial court. He argues that application of the safe harbor provisions in this situation renders section 128.7 an empty formality and undermines the purpose of the statute. These arguments do not bear close scrutiny. First, the safe harbor provisions in question are expressly part of the section of the statute applicable to sanctions motions by the court. They have not been implied or engrafted from generic provisions. Thus, the statute is clear and unambiguous on this issue. Second, the purpose of section 128.7 is to promote compliance. To this end, the statute permits withdrawal of a challenged pleading. Once the pleading has been ruled on dispositively, withdrawal is ineffective and compliance is not possible. At this point, imposition of sanctions becomes strictly punitive, not an intended purpose of the statute. Finally, the purpose of the statute is more clearly effectuated by an early sanctions motion brought by a party prior to a motion for summary judgment. Such an early motion prevents the undue costs and delay engendered by pursuit of a frivolous action to a ruling on a dispositive motion.
Dr. Hamrell raises one further contention worthy of brief discussion. He contends that interpretation of the safe harbor provisions to preclude the imposition of sanctions under these circumstances, renders another provision of the statute surplusage. He points to section 128.7, subdivision (d)(2), which prohibits a trial court from initiating a monetary sanctions motion against a party after the party has voluntarily dismissed or settled the action. The purpose of this subdivision is to protect parties who settle a case from later facing unexpected monetary sanctions which might, if known, have affected their willingness to settle or dismiss the action. (See Com. Notes on 1993 Amends, to Rule 11.)[5] It appears that the voluntary dismissal/settlement subdivision may very well be surplusage. We can discern no situation in which sanctions following a voluntary dismissal or settlement would not be precluded by both the safe harbor provisions and the voluntary dismissal/settlement provisions. This duplicativeness may be the result of *719 timing and inadvertence. The voluntary dismissal/settlement provision is included in Rule 11 and was part of section 128.7 from the outset. Rule 11 does not include a safe harbor limitation on motions initiated by the court. The provision of section 128.7 adding a safe harbor period to court initiated sanctions was inserted at a later time, and the drafters may not have recognized the effect of the safe harbor provisions on the voluntary dismissal/settlement provisions. In any event, the safe harbor provisions are express and unambiguous. The fact that their enforcement renders another provision duplicative does not nullify the express language. An appellate court is to interpret a statute where possible to avoid surplus language. (Arnett v. Dal Cieb (1996) 14 Cal.4th 4, 22, 56 Cal.Rptr.2d 706, 923 P.2d 1.) "But the avoidance of surplusage, while an important principle of statutory construction, is nonetheless subordinate to the overriding purpose of effectuating legislative intent. `Rules such as those directing courts to avoid interpreting legislative enactments as surplusage are mere guides and will not be used to defeat legislative intent. [Citations.] As we have already stressed, the fundamental goal of statutory interpretation is to ascertain and carry out the intent of the Legislature.'" (People v. Townsend (1998) 62 Cal.App.4th 1390,1399, 73 Cal.Rptr.2d 438.)

Sanctions Awarded to Dr. Hamrell
The trial court initiated sanctions on its own motion following the grant of summary judgment. It awarded sanctions against Attorney Fagel in favor of Dr. Hamrell. This was unauthorized. Sanctions may consist of nonmonetary directives, penalties payable to the court, and, on a party's motion, monetary sanctions payable to the moving party. "[T]he sanction may consist of, or include, directives of a nonmonetary nature, an order to pay a penalty into court, or, if imposed on motion and warranted for effective deterrence, an order directing payment to the movant of some or all of the reasonable attorney's fees and other expenses incurred as a direct result of the violation." (§ 128.7, subd. (d).) A monetary sanction imposed after a court motion is limited to a penalty payable to the court and may not include or consist of monetary sanctions payable to a party. (Barber v. Miller (9th Cir. 1998) 146 F.3d 707, 711.) The sanctions award in favor of Dr. Hamrell must be reversed also on this ground.

Conclusion
The safe harbor provisions of section 128.7 prohibit a trial court from initiating sanctions on its own motion following the conclusion of the case or a dispositive ruling on the challenged pleading. Under section 128.7, a trial court may not award monetary sanctions to a party where the motion is brought on the court's initiative.

DISPOSITION
The sanctions order is reversed. The parties are to bear their own costs on appeal.
ARMSTRONG, J, and GODOY PEREZ, J., concur.
NOTES
[1]  All further statutory references are to the Code of Civil Procedure.
[2]  Section 128.7 reads in full as follows: "(a) very pleading, petition, written notice of motion, or other similar paper shall be signed by at least one attorney of record in the attorney's individual name, or, if the party is not represented by an attorney, shall be signed by the party. Each paper shall state the signer's address and telephone number, if any. Except when otherwise provided by law, pleadings need not be verified or accompanied by affidavit. An unsigned paper shall be stricken unless omission of the signature is corrected promptly after being called to the attention of the attorney or party. [¶] (b) By presenting to the court, whether by signing, filing, submitting, or later advocating, a pleading, petition, written notice of motion, or other similar paper, an attorney or unrepresented party is certifying that to the best of the person's knowledge, information, and belief, formed after an inquiry reasonable under the circumstances, all of the following conditions are met: [¶] (1) It is not being presented primarily for an improper purpose, such as to harass or to cause unnecessary delay or needless increase in the cost of litigation. [¶] (2) The claims, defenses, and other legal contentions therein are warranted by existing law or by a nonfrivolous argument for the extension, modification, or reversal of existing law or the establishment of new law. [¶] (3) The allegations and other factual contentions have evidentiary support or, if specifically so identified, are likely to have evidentiary support after a reasonable opportunity for further investigation or discovery. [¶] (4) The denials of factual contentions are warranted on the evidence or, if specifically so identified, are reasonably based on a lack of information or belief. [¶] (c) If, after notice and a reasonable opportunity to respond, the court determines that subdivision (b) has been violated, the court may, subject to the conditions stated below, impose an appropriate sanction upon the attorneys, law firms, or parties that have violated subdivision (b) or are responsible for the violation. In determining what sanctions, if any, should be ordered, the court shall consider whether a party seeking sanctions has exercised due diligence. [¶] (1) A motion for sanctions under this section shall be made separately from other motions or requests and shall describe the specific conduct alleged to violate subdivision (b). Notice of motion shall be served as provided in Section 1010, but shall not be filed with or presented to the court unless, within 30 days after service of the motion, or such other period as the court may prescribe, the challenged paper, claim, defense, contention, allegation, or denial is not withdrawn or appropriately corrected. If warranted, the court may award to the party prevailing on the motion the reasonable expenses and attorney's fees incurred in presenting or opposing the motion. Absent exceptional circumstances, a law firm shall be held jointly responsible for violations committed by its partners, associates, and employees. [¶] (2) On its own motion, the court may enter an order describing the specific conduct that appears to violate subdivision (b) and directing an attorney, law firm, or party to show cause why it has not violated subdivision (b), unless, within 30 days of service of the order to show cause, the challenged paper, claim, defense, contention, allegation, or denial is withdrawn or appropriately corrected. [¶] (d) A sanction imposed for violation of subdivision (b) shall be limited to what is sufficient to deter repetition of this conduct or comparable conduct by others similarly situated. Subject to the limitations in paragraphs (1) and (2), the sanction may consist of, or include, directives of a nonmonetary nature, an order to pay a penalty into court, or, if imposed on motion and warranted for effective deterrence, an order directing payment to the movant of some or all of the reasonable attorney's fees and other expenses incurred as a direct result of the violation. [¶] (1) Monetary sanctions may not be awarded against a represented party for a violation of paragraph (2) of subdivision (b). [¶] (2) Monetary sanctions may not be awarded on the court's motion unless the court issues its order to show cause before a voluntary dismissal or settlement of the claims made by or against the party that is, or whose attorneys are, to be sanctioned. [¶] (e) When imposing sanctions, the court shall describe the conduct determined to constitute a violation of this section and explain the basis for the sanction imposed. [¶] (f) In addition to any award pursuant to this section for conduct described in subdivision (b), the court may assess punitive damages against the plaintiff upon a determination by the court that the plaintiff's action was an action maintained by a person convicted of a felony against the person's victim, or the victim's heirs, relatives, estate, or personal representative, for injuries arising from the acts for which the person was convicted of a felony, and that the plaintiff is guilty of fraud, oppression, or malice in maintaining the action. [¶] (g) This section shall not apply to disclosures and discovery requests, responses, objections, and motions. [¶] (h) A motion for sanctions brought by a party or a party's attorney primarily for an improper purpose, such as to harass or to cause unnecessary delay or needless increase in the cost of litigation, shall itself be subject to a motion for sanctions. It is the intent of the Legislature that courts shall vigorously use its sanctions authority to deter such improper conduct or comparable conduct by others similarly situated. [¶] (i) This section shall apply to a complaint or petition filed on or after January 1, 1995, and any other pleading, written notice of motion, or other similar paper filed in such a matter. [¶] (j) This section shall remain in effect only until January 1, 2003, and as of that date is repealed, unless a later enacted statute, that is enacted before January 1, 2003, deletes or extends that date."
[3]  It has been recognized, however, that the safe harbor provisions permit a party to file an improper pleading and escape sanctions, simply by withdrawing the pleading when challenged. (Ridder v. City of Springfield (6th Cir.1997) 109 F.3d 288, 294-295.)
[4]  A plaintiff's right to a voluntary dismissal of a complaint is terminated as of the moment of a ruling effectively disposing of the case. (M & R Properties v. Thomson (1992) 11 Cal.App.4th 899, 903, 14 Cal.Rptr.2d 579.) This is so whether the dismissal is with or without prejudice. (See §581, subd. (b)(1).)
[5]  "[T]he Senate Committee on Judiciary report indicated that the `Notes of the Advisory Committee' for [R]ule 11 were adopted as a statement of legislative intent for" the bill that enacted section 128.7. (Goodstone v. Southwest Airlines Co. (1998) 63 Cal.App.4th 406, 423, 73 Cal.Rptr.2d 655.)
