
168 Cal.App.4th 874 (2008)
MARINA GLENCOE, L.P., Plaintiff and Respondent,
v.
NEUE SENTIMENTAL FILM AG, Defendant and Appellant.
No. B203931.
Court of Appeals of California, Second District, Division Four.
November 25, 2008.
*875 Squire, Sanders & Dempsey and James H. Broderick, Jr., for Defendant and Appellant.
Westlake Law Group, Julian A. Simonis; Law Offices of Gary L. Bostwick and Gary L. Bostwick for Plaintiff and Respondent.


*876 OPINION
EPSTEIN, P. J.
In this case, we hold that when a contract provides that the prevailing party is entitled to attorney fees and the plaintiff dismisses the action with prejudice after the start of trial, the defendant is not entitled to attorney fees as the prevailing party. We also find that in this case defendant did not make a statutory offer to compromise within the meaning of Code of Civil Procedure section 998, and hence cannot recover attorney fees as costs under that statute.

FACTUAL AND PROCEDURAL SUMMARY
Neue Sentimental Film USA (NSF-USA) leased a commercial property from Marina Glencoe, L.P. The lease contained a provision for an award of attorney fees and costs to the prevailing party "if any action for breach of or to enforce the provisions of this Lease is commenced...." NSF-USA fell behind in rent, and in May 2003, Marina Glencoe sued NSF-USA and two related companies, Neue Sentimental Film AG (NSF-AG) and Neue Sentimental Film N.Y., Inc. (NSF-NY), for breach of the lease. Marina Glencoe's theory was that each of these related companies also owed rent as the alter ego of NSF-USA. NSF-USA filed bankruptcy in August 2003, and NSF-AG answered the complaint on September 3, 2004.
On September 29, 2004, NSF-AG sent a letter to Marina Glencoe offering to settle the case. The offer stated it would be deemed rejected if it was not accepted in writing by October 4, 2004.
The bench trial proceeded only against NSF-AG. At Marina Glencoe's request, the court bifurcated the trial to adjudicate the issue of liability based on alter ego first and then determine damages. After Marina Glencoe rested on the alter ego liability phase of trial, NSF-AG moved for judgment pursuant to Code of Civil Procedure section 631.8. The court heard argument but did not rule on the motion that day, explaining that it wanted to review the exhibits, reread deposition testimony, and then give a tentative ruling by the end of the next day. The following day, prior to the court issuing a ruling on the pending motion, Marina Glencoe filed a voluntary dismissal of the action with prejudice.
NSF-AG moved for attorney fees as the prevailing party pursuant to the attorney fee provision in the lease. The court concluded NSF-AG was not *877 entitled to attorney fees under either Civil Code section 1717 or Code of Civil Procedure section 998. This is a timely appeal from the order denying attorney fees.

DISCUSSION

I
Civil Code section 1717 (section 1717) provides: "(a) In any action on a contract, where the contract specifically provides that attorney's fees and costs, which are incurred to enforce that contract, shall be awarded either to one of the parties or to the prevailing party, then the party who is determined to be the party prevailing on the contract, whether he or she is the party specified in the contract or not, shall be entitled to reasonable attorney's fees in addition to other costs."
This action was for breach of a written lease which included the following attorney fee provision: "[I]f any action for breach of or to enforce the provisions of this Lease is commenced, the court in such action shall award to the party in whose favor a judgment is entered, a reasonable sum as attorneys' fees and costs. The losing party in such action shall pay such attorneys' fees and costs." Based on this contract provision, after respondent Marina Glencoe dismissed the action, appellant NSF-AG sought attorney fees as the prevailing party under section 1717.
(1) The problem for appellant is the explicit language of section 1717, subdivision (b)(2): "Where an action has been voluntarily dismissed or dismissed pursuant to a settlement of the case, there shall be no prevailing party for purposes of this section." Subdivision (b)(2) contains no temporal limitation; it "bars recovery of section 1717 attorney fees regardless of when the dismissal is filed." (Topanga and Victory Partners v. Toghia (2002) 103 Cal.App.4th 775, 782, fn. 3 [127 Cal.Rptr.2d 104].)
At respondent's request, the court dismissed the action with prejudice as to appellant, while appellant's motion for judgment was pending. (See Code Civ. Proc., § 581, subd. (e).) Appellant argues this should not be deemed a voluntary dismissal. But, as the court explained in D & J, Inc. v. Ferro Corp. (1986) 176 Cal.App.3d 1191, 1194 [222 Cal.Rptr. 656]: "It is not the stage of the proceedings which distinguishes a voluntary dismissal from an involuntary one. Rather, the key is the plaintiff's role, if any, in bringing it about." *878 The dismissal in this case, having been entered at respondent's request, is voluntary. (Id. at p. 1193.) Thus there is no prevailing party for purposes of recovering attorney fees and costs incurred in defending the contract action under section 1717. (See Santisas v. Goodin (1998) 17 Cal.4th 599, 617 [71 Cal.Rptr.2d 830, 951 P.2d 399].)
Appellant seeks to avoid the voluntary dismissal limitation in section 1717, subdivision (b)(2), noting that a plaintiff's right to dismiss a defendant or an entire action is not unlimited. "A plaintiff is precluded from voluntarily dismissing an action without prejudice under various circumstances short of a full trial. Those circumstances include a general demurrer sustained without leave to amend, a general demurrer sustained with leave to amend where no amendment is made within the allotted time, and where all issues have been deemed admitted in defendant's favor." (Mary Morgan, Inc. v. Melzark (1996) 49 Cal.App.4th 765, 769 [57 Cal.Rptr.2d 4].) Similarly, when a defendant's right to obtain summary judgment has ripened to the point of inevitability, a plaintiff generally cannot avoid summary judgment by filing a voluntary dismissal without prejudice before the court rules on the summary judgment motion. (Tire Distributors, Inc. v. Cobrae (2005) 132 Cal.App.4th 538, 544 [33 Cal.Rptr.3d 761], discussing Mary Morgan, Inc. v. Melzark, supra, 49 Cal.App.4th at pp. 769-770; see also Cravens v. State Bd. of Equalization (1997) 52 Cal.App.4th 253, 257 [60 Cal.Rptr.2d 436].)
Unlike the plaintiffs in those cases, respondent filed a voluntary dismissal with prejudice. Its intent was to end the litigation, not to manipulate the judicial process to avoid its inevitable end. This was entirely proper. (See Tire Distributors v. Cobrae, supra, 132 Cal.App.4th at pp. 542-543 [plaintiff believed dismissal was required by terms of settlement he sought to enforce]; Mossanen v. Monfared (2000) 77 Cal.App.4th 1402, 1408-1409 [92 Cal.Rptr.2d 459] [summary judgment motion filed on day minor's counsel allowed to withdraw; guardian ad litem had to seek dismissal because she was not an attorney and could not oppose the summary judgment motion without counsel].)
Appellant also relies on Liu v. Moore (1999) 69 Cal.App.4th 745, 751 [81 Cal.Rptr.2d 807]. In that case, the court held that a defendant who is voluntarily dismissed after filing a special motion to strike pursuant to Code of Civil Procedure section 425.16 (the anti-SLAPP statute (strategic lawsuit against public participation)) is entitled to have the merits of the motion heard as a predicate to a determination of its motion for attorney fees and costs. But the purpose of Code of Civil Procedure section 425.16 is "to give relief, including financial relief in the form of attorney's fees and costs, to *879 persons who have been victimized by meritless, retaliatory SLAPP lawsuits because of their `participation in matters of public significance' (§ 425.16, subd. (a))." (69 Cal.App.4th at p. 750.)
(2) Nothing in section 1717 suggests an intent to punish a party by awarding attorney fees; its intent is to make reciprocal any contractual right to attorney fees. (See International Industries, Inc. v. Olen (1978) 21 Cal.3d 218, 223 [145 Cal.Rptr. 691, 577 P.2d 1031].) And the statute specifically contemplates the voluntary dismissal of an action as an exception to an award of fees to the prevailing party. Cases arising under the anti-SLAPP statute do not change this result. Appellant was not entitled to an award of attorney fees under section 1717.

II
Appellant also claimed it had a right to attorney fees as costs under Code of Civil Procedure section 998 (section 998) because respondent rejected its offer and failed to achieve a better result at trial. Under section 998, as in effect in 2004 when the offer was made, "Not less than 10 days prior to commencement of trial ..., any party may serve an offer in writing upon any other party to the action to allow judgment to be taken or an award to be entered in accordance with the terms and conditions stated at that time." (§ 998, subd. (b).)[1] "If the offer is not accepted prior to trial or arbitration, [or] within 30 days after it is made, whichever occurs first, it shall be deemed withdrawn, and cannot be given in evidence upon the trial or arbitration." (Former § 998, subd. (b)(2).)[2] "If an offer made by a defendant is not accepted and the plaintiff fails to obtain a more favorable judgment or award, the plaintiff shall not recover his or her postoffer costs and shall pay the defendant's costs from the time of the offer." (§ 998, subd. (c)(1).)
In a letter to respondent dated September 29, 2004, and labeled "CONFIDENTIAL SETTLEMENT OFFER PURSUANT TO CCP § 998," appellant explained the basis for its belief that respondent could not prevail in the action. The letter then provides: "While Neue AG strongly believes that this *880 action is baseless and Marina can not and will not prevail in establishing an alter ego relationship, it is willing to settle this case at this time only for the purpose of avoiding the attorneys' fees it will devote to defeating the claim. I want to emphasize this offer is enormously generous (frankly beyond our recommendations), and is not an invitation to bargain or counteroffer. We are at a decision-making juncture and if you do not accept the offer, we will proceed with the defense of this action. For this reason we will need your decision no later than October 4, as we will then start our own discovery, prepare our motions and this offer will be off the table and will not be renewed. [¶] As I indicated, for these reasons, Neue AG is willing to offer $120,000, payable at $5,000 per month for 24 months, to settle this case." The letter concludes: "This offer is made confidentially and for the sole purpose of reaching a settlement; it shall not be used for any other purpose or introduced to prove Neue AG's liability. This offer is deemed rejected if it is not accepted in writing received by Neue AG by October 4, 2004."
Respondent argues this offer did not provide sufficient time for acceptance, as required under section 998. We agree.[3]
(3) In order to function as an offer for purposes of section 998, an offer must remain open for the statutorily designated period"prior to trial or ... within 30 days after it is made, whichever occurs first...." (§ 998, subd. (b)(2); see Marcey v. Romero (2007) 148 Cal.App.4th 1211, 1215 [56 Cal.Rptr.3d 402].) A section 998 offer to settle may be revoked before acceptance, but if revoked prior to the expiration of the statutory period, it no longer functions as an "offer" for purposes of the cost benefits of section 998. (T.M. Cobb Co. v. Superior Court (1984) 36 Cal.3d 273, 283, fn. 13 [204 Cal.Rptr. 143, 682 P.2d 338]; Marcey v. Romero, supra, 148 Cal.App.4th at p. 1216.)
Appellant's offer was made on September 29, 2004, and was open only until October 4, 2004, well short of the statutorily designated period. Once revoked by the expiration of that period, it was no longer an "offer" for purposes of the cost benefits of section 998. (Marcey v. Romero, supra, 148 Cal.App.4th at p. 1216.) Appellant was not entitled to attorney fees based on section 998.


*881 DISPOSITION
The order is affirmed. Respondent shall have its costs on appeal.
Willhite, J., and Suzukawa, J., concurred.
NOTES
[1]  Effective January 1, 2006, section 998, subdivision (b) was amended to include the following language: "The written offer shall include a statement of the offer, containing the terms and conditions of the judgment or award, and a provision that allows the accepting party to indicate acceptance of the offer by signing a statement that the offer is accepted. Any acceptance of the offer, whether made on the document containing the offer or on a separate document of acceptance, shall be in writing and shall be signed by counsel for the accepting party or, if not represented by counsel, by the accepting party."
[2]  The bracketed word "or" was added without comment by amendment in 2005.
[3]  The trial court found that appellant's offer satisfied the requirements for section 998, and thus that appellant was entitled to postoffer costs. But the court found that it could not award attorney fees as costs under that section under the narrow language of the attorney fee provision in the lease. Having concluded that the offer did not satisfy the requirements for section 998, we need not and do not address the court's interpretation of the attorney fee provision.
