
173 Cal.App.4th 1533 (2009)
___ Cal.Rptr.3d ___
SILVER CREEK, LLC, et al., Plaintiffs and Appellants,
v.
BLACKROCK REALTY ADVISORS, INC., Defendant and Respondent,
No. D052587.
Court of Appeals of California, Fourth District, Division One.
May 20, 2009.
*1535 Niddrie, Fish & Buchanan, David A. Niddrie; Ferrette Alcorn Pharies & Dorgan, Glen F. Dorgan; and Eric Mogensen for Plaintiffs and Appellants.
Winston & Strawn, John S. Gibson and Veronica L. Harris for Defendant and Respondent.


*1536 OPINION
McINTYRE, J.
In this case, we conclude the trial court abused its discretion when it decided there was no prevailing party on a contract for purposes of awarding attorney fees under subdivision (b) of Civil Code section 1717 because the record clearly revealed that one party obtained greater relief on the contract in this mixed result case. (All undesignated statutory references are to the Civil Code.) Accordingly, we reverse the order denying attorney fees and remand the matter for further proceedings.

FACTUAL AND PROCEDURAL BACKGROUND
In 2005, BlackRock Realty Advisors, Inc. (BlackRock), executed agreements to purchase two commercial properties owned by Silver Creek, LLC, and Griffin Properties, LLC (together Silver Creek), for a total purchase price of $29.75 million and deposited a total of about $1.13 million into escrow accounts. The agreements specified that, among other things, BlackRock would assume existing loans on the properties, the loan assumption agreements had to be satisfactory to Silver Creek and the sale transactions would close no later than July 1, 2005.
During escrow, a dispute arose between the parties regarding the terms of the loan assumption agreements. Shortly after the deadline for closing, Silver Creek notified BlackRock that it considered the agreements and escrow terminated for failure to comply with the closing deadline and obtain satisfactory loan assumption agreements. When BlackRock refused to acknowledge the termination, Silver Creek sent a detailed letter averring that it was not in default under the agreements but offering to relinquish its rights to the deposit upon execution of an acceptable settlement agreement. After BlackRock failed to formally respond to its letter, Silver Creek filed the instant action for declaratory relief seeking a declaration that it validly terminated the agreements and was entitled to retain the deposit.
BlackRock filed a cross-complaint alleging that Silver Creek had breached its obligation to act reasonably in approving a loan release and thus its purported termination of the agreements was invalid. BlackRock sought damages and return of its deposit for Silver Creek's alleged breach of the agreements or, alternatively, specific performance of the agreements. Before trial, the parties certified under penalty of perjury that entitlement to the deposit was a disputed issue.
*1537 The matter proceeded to a bench trial and the court heard testimony from a Silver Creek representative that it did not want the deposit, but wanted to get the properties back on the market. BlackRock representatives testified that BlackRock's goal was to obtain the properties and it was not willing to merely accept its deposit and walk away from the deal. In a posttrial brief, Silver Creek noted that the agreements provided that the deposit would be paid to it if the deal did not close by the closing date and that BlackRock would get the deposit if Silver Creek disapproved the loan assumption and terminated the agreements. Silver Creek also reiterated that it sought to regain control of the properties, "[k]eeping the deposit has never been an objective" and it deferred to the court on resolution of that issue.
The trial court issued a detailed statement of decision finding in favor of Silver Creek on the complaint and BlackRock's cross-complaint, but concluding that BlackRock was entitled to a return of the deposit. The trial court noted that the primary issue before it was whether Silver Creek was in default of the agreements when it gave notice of the termination and "secondarily" the proper disposition of the deposit. The trial court found that Silver Creek did not act in bad faith or engage in any financial impropriety or deceptive or sharp practices and had "in every respect acted in good faith."
As relevant to this appeal, the trial court found that (1) Silver Creek's disapproval of the loan assumption was reasonable and in good faith and that no reasonable person in its position would have approved the proposed loan assumption agreements; and (2) BlackRock had not done what it was required to do under the agreements and was not "in any respect ready to perform" under the agreements by the July deadline. The trial court then looked to the language of the agreements to resolve the disposition of the deposit, stating that the agreements provided that if BlackRock was unable to negotiate an assumption of the loans it would be entitled to return of the deposit. The trial court entered a judgment declaring that Silver Creek had properly terminated the agreements, denying all of BlackRock's claims and returning the deposit to BlackRock. Although BlackRock appealed from the judgment, the appeal has since been dismissed and the judgment is now final.
Silver Creek filed a motion for attorney fees claiming it was the prevailing party on the contract under section 1717 and the agreements. Specifically, the agreements provided that if any proceeding is brought in connection with the agreements that the prevailing party "shall be entitled" to recover reasonable attorney fees and that "[t]he parties intend this provision to be given the most *1538 liberal construction possible and to apply in any circumstances in which such party reasonably incurs expenses."
The trial court found that Silver Creek did not "win an unqualified victory" because BlackRock was entitled to return of the deposit. Accordingly, it concluded that it had discretion on finding a prevailing party and denied the motion because Silver Creek had succeeded on its contentions regarding termination of the agreements, but BlackRock had succeeded on its claim for the deposit and it could not "determine at this time that one party has obtained greater relief than the other." Silver Creek timely appealed from this order.

DISCUSSION

I. Legal Principles and Standard of Review

(1) In an action on a contract, section 1717 permits an award of attorney fees to the prevailing party. "[T]he party prevailing on the contract shall be the party who recovered a greater relief in the action on the contract. The court may also determine that there is no party prevailing on the contract for purposes of this section." (§ 1717, subd. (b), italics added.) (2) A declaratory relief action that seeks to establish the parties' rights under a contract is an action to enforce the contract. (Exxess Electronixx v. Heger Realty Corp. (1998) 64 Cal.App.4th 698, 710-711 [75 Cal.Rptr.2d 376].)
(3) When a party obtains a "`simple, unqualified win'" by completely prevailing on, or defeating, the contract claims in the action and the contract contains a provision for attorney fees, the successful party is entitled to attorney fees as a matter of right, eliminating the trial court's discretion to deny fees under section 1717. (Hsu v. Abbara (1995) 9 Cal.4th 863, 875-876 [39 Cal.Rptr.2d 824, 891 P.2d 804] (Hsu).) "If neither party achieves a complete victory on all the contract claims, it is within the discretion of the trial court to determine which party prevailed on the contract or whether, on balance, neither party prevailed sufficiently to justify an award of attorney fees." (Scott Co. v. Blount, Inc. (1999) 20 Cal.4th 1103, 1109 [86 Cal.Rptr.2d 614, 979 P.2d 974].) "Because the statute allows such discretion, it must be presumed the trial court has also been empowered to identify the party obtaining `a greater relief' by examining the results of the action in relative terms: the general term `greater' includes `[l]arger in size than others of the same kind' as well as `principal' and `[s]uperior in quality.' [Citation.]" (Sears v. Baccaglio (1998) 60 Cal.App.4th 1136, 1151 [70 Cal.Rptr.2d 769].)
*1539 (4) When determining the prevailing party under section 1717, the trial court "is to compare the relief awarded on the contract claim or claims with the parties' demands on those same claims and their litigation objectives as disclosed by the pleadings, trial briefs, opening statements, and similar sources." (Hsu, supra, 9 Cal.4th at p. 876.) Additionally, "in determining litigation success, courts should respect substance rather than form, and to this extent should be guided by `equitable considerations.' For example, a party who is denied direct relief on a claim may nonetheless be found to be a prevailing party if it is clear that the party has otherwise achieved its main litigation objective. [Citations.]" (Id. at p. 877, italics omitted.) A trial court has wide discretion in determining which party is the prevailing party under section 1717, and we will not disturb the trial court's determination absent "a manifest abuse of discretion, a prejudicial error of law, or necessary findings not supported by substantial evidence." (Yield Dynamics, Inc. v. TEA Systems Corp. (2007) 154 Cal.App.4th 547, 577 [66 Cal.Rptr.3d 1].)

II. Analysis

Silver Creek asserts the trial court lacked discretion to deny its request for attorney fees because it never actually litigated the deposit issue and obtained an unqualified win on the issues actually litigated. We reject this contention.
The trial court correctly noted that despite the multiple arguments tendered by the parties, the litigation presented two issues under the agreements whether Silver Creek was in default of the agreements and proper disposition of the deposit. Silver Creek won on the first contractual issue and lost on the second; accordingly, it did not obtain a "`simple, unqualified win'" and was not entitled to an award of attorney fees as a matter of right. (Hsu, supra, 9 Cal.4th at p. 876.)
We reject Silver Creek's suggestion that the parties did not actually litigate the deposit issue because they never pursued it at trial. Silver Creek and BlackRock claimed a right to the deposit in their respective pleadings and agreed before trial that the court needed to resolve the issue. As Silver Creek recognized in its posttrial brief, the agreements dictated which party received the deposit once the trial court determined the contract provision upon which Silver Creek had terminated the agreements. Accordingly, although there was no evidence to present and no need for the parties to even argue the deposit issue at trial, the parties still litigated the deposit issue and the court resolved it.
*1540 Silver Creek next contends that the trial court abused its discretion by finding neither party had obtained greater relief than the other because each party won a contract issue and lost a contract issue. We agree. Straightforward application of the principles announced in Hsu reveals that the trial court's finding is not supported by the evidence.
(5) The party prevailing on the contract is the party who recovered "greater relief in the action on the contract" (§ 1717, subd. (b)(1)), and the only way to determine prevailing party status is by evaluating the parties' comparative litigation success. (Hsu, supra, 9 Cal.4th at p. 876.) Here, although the parties asked the court to decide the deposit issue in their respective favors, the trial court correctly recognized in its statement of decision that the main litigation objective for the parties was disposition of the properties and that the deposit issue was "secondar[y]" and controlled by the language of the agreements. The trial court, however, ignored this when ruling on the attorney fee motion and then oversimplified its duties by counting the number of contract claims presented and essentially declaring a tie because each party won one of the claims presented for resolution.
The record reveals that the property issue was most important to the parties and "greater" in terms of monetary valueabout $29.75 million at issue for the properties versus about $1.13 million at issue for the deposit. Thus, Silver Creek achieved its main litigation objective, while BlackRock clearly failed to accomplish its desired goal even though it obtained the return of its deposit. (Hsu, supra, 9 Cal.4th at p. 877 [a party denied direct relief on a claim may be found to be a prevailing party if it clearly achieved its main litigation objective].)
We reject BlackRock's argument that because there was no evidence it had acted improperly, the trial court furthered equity by refusing to "punish" it by awarding attorney fees. This argument overlooks the fact that Silver Creek sued BlackRock for declaratory relief; it never alleged that BlackRock acted improperly and the lack of evidence on this point is meaningless. In any event, the trial court's ruling does not support this contention and such a result would be contrary to the principles enunciated in Hsu.
(6) Hsu indicated that equitable considerations must be connected to litigation success on the claims presented and cautioned against examining the litigation tactics of the parties. (Hsu, supra, 9 Cal.4th at p. 877 ["To admit such factors into the `prevailing party' equation would convert the attorney *1541 fees motion from a relatively uncomplicated evaluation of the parties' comparative litigation success into a formless, limitless attack on the ethics and character of every party who seeks attorney fees under section 1717."].) It would be similarly improper for a trial court to consider the fault of the parties or their litigation motives in making a prevailing party determination under section 1717.
BlackRock's reliance on Hilltop Investment Associates v. Leon (1994) 28 Cal.App.4th 462 [33 Cal.Rptr.2d 552] (Hilltop), McLarand, Vasquez & Partners, Inc. v. Downey Savings & Loan Assn. (1991) 231 Cal.App.3d 1450 [282 Cal.Rptr. 828] (McLarand) and Kytasty v. Godwin (1980) 102 Cal.App.3d 762 [162 Cal.Rptr. 556] (Kytasty) is misplaced because these cases were all decided before Hsu. Additionally, these cases are distinguishable on their facts. (Hsu, supra, 9 Cal.4th at p. 873 [The results in Kytasty were "so equivocal as to permit or even require that no party be found to have prevailed for purposes of attorney fees under section 1717."]; Hilltop, at p. 468 [no abuse of discretion in denying attorney fees where the result was "a draw"]; McLarand, at p. 1456 [each party sued the other claiming breach of contract, but a jury found there had been no breach by either party and denied all relief].)
BlackRock agreed that the prevailing party in any action on the contract would obtain its attorney fees. Accordingly, BlackRock knew at the outset of this litigation that if it prevailed it would receive attorney fees and if it lost, it would bear the consequence of having to pay Silver Creek's attorney fees. The enforcement of this provision of the agreements is not inequitable. (Marina Glencoe, L.P. v. Neue Sentimental Film AG (2008) 168 Cal.App.4th 874, 879 [85 Cal.Rptr.3d 800] ["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."].)
(7) Although a trial court has broad discretion to determine the prevailing party in a mixed result case, its discretion is not unlimited. The record indisputably shows that Silver Creek obtained the greater relief on the contract. Accordingly, the trial court abused its discretion by finding neither party achieved greater relief on the contract and denying Silver Creek its attorney fees under section 1717.
Finally, we agree with Silver Creek's contention that it is entitled to its attorney fees incurred in this appeal. (Butler-Rupp v. Lourdeaux (2007) 154 Cal.App.4th 918, 923 [65 Cal.Rptr.3d 242].) This matter is remanded to the trial court with directions to conduct further proceedings to determine Silver Creek's reasonable attorney fees incurred in connection with the trial and this appeal.


*1542 DISPOSITION
The order is reversed and the matter is remanded for further proceedings consistent with this opinion. Appellants are entitled to costs on appeal.
McConnell, P. J., and Benke, J., concurred.
