
3 Cal.App.4th 1338 (1992)
5 Cal. Rptr.2d 154
ANTHONY XUEREB et al., Plaintiffs and Respondents,
v.
MARCUS & MILLICHAP, INC., et al., Defendants and Appellants.
Docket No. A051052.
Court of Appeals of California, First District, Division Three.
February 26, 1992.
*1340 COUNSEL
Bronson, Bronson & McKinnon, Robert J. Stumpf, Jr., and Alan J. Lazarus for Defendants and Appellants.
Ropers, Majeski, Kohn, Bentley, Wagner & Kane, Mark G. Bonino and Charles M. Marx for Plaintiffs and Respondents.
OPINION
MERRILL, J. 

PROCEDURAL BACKGROUND
Respondents Anthony and Jeanette Xuereb brought suit against appellants Marcus & Millichap, Inc., a licensed real estate broker, and Thomas J. Coates, a licensed commercial real estate agent employed with Marcus & Millichap, alleging various causes of action arising out of a real estate transaction in which respondents were the purchasers. Following a jury trial in which the jury returned a verdict in their favor, appellants filed a motion for attorney fees and costs pursuant to an attorney fees clause contained in the agreement executed in connection with the real estate transaction (the Purchase Agreement). The trial court denied the motion on the ground that the case had been tried on tort theories rather than on the contract. We have determined that the trial court erred in denying appellants' motion for attorney fees.

FACTS
The facts of the underlying real estate sale need not be examined in detail, except insofar as they concern the circumstances of the parties' execution of the subject Purchase Agreement. The agreement, which was signed by respondents as purchasers and appellants as agents, contained the following provision: "Attorneys' Fees: If this Agreement gives rise to a lawsuit or other legal proceeding between any of the parties hereto, including Agent, the prevailing party shall be entitled to recover actual court costs and reasonable attorneys' fees in addition to any other relief to which such party may be entitled."
*1341 Respondents' lawsuit, as originally filed, alleged that appellants and other parties, including the sellers of the real property which was the subject of the Purchase Agreement, had delivered the property to respondents in defective condition. The complaint included causes of action for negligence, products liability, fraud and misrepresentation, and breach of contract against appellants as well as the other defendants. Also contained in the complaint was a request for attorney fees under the attorney fees provision of the Purchase Agreement.
After lengthy pretrial proceedings during which respondents settled with the other parties, the case went to trial against appellants. In the course of the trial, the trial court gave respondents permission to amend the complaint to add a claim for breach of fiduciary duty against appellants. The allegation that respondents were entitled to attorney fees remained in the complaint.
At the conclusion of testimony, respondents submitted their case to the jury on the theories of negligence, breach of fiduciary duty, concealment and misrepresentation, but not on the breach of contract cause of action. The jury returned its verdict in favor of appellants on all causes of action. Thereafter, the trial court denied appellants' motion for attorney fees under the applicable provision of the Purchase Agreement. It based its decision to deny the motion on its conclusion that it could "not find that [Code of Civil Procedure section] 1021 somehow overrides the case law interpreting Civil Code section 1717 or is a separate basis for awarding attorney's fees."

DISCUSSION
(1) Code of Civil Procedure section 1021 provides the basic right to an award of attorney fees. (Brusso v. Running Springs Country Club, Inc. (1991) 228 Cal. App.3d 92, 101 [278 Cal. Rptr. 758].) It states: "Except as attorney's fees are specifically provided for by statute, the measure and mode of compensation of attorneys and counselors at law is left to the agreement, express or implied, of the parties; but parties to actions or proceedings are entitled to their costs, as hereinafter provided." Under this statute, the allocation of attorney fees is left to the agreement of the parties. There is nothing in the statute that limits its application to contract actions alone. It is quite clear from the case law interpreting Code of Civil Procedure section 1021 that parties may validly agree that the prevailing party will be awarded attorney fees incurred in any litigation between themselves, whether such litigation sounds in tort or in contract. (Skyway Aviation, Inc. v. Troyer (1983) 147 Cal. App.3d 604, 610-611 [195 Cal. Rptr. 281]; Malibou Lake Mountain Club, Ltd. v. Smith (1971) 18 Cal. App.3d 31, 35-36 [95 Cal. Rptr. 553].)
Contrary to the trial court's stated rationale for denying appellants' request for attorney fees, Civil Code section 1717 does not control the interpretation *1342 of the attorney fees provision in this case.[1] Civil Code section 1717 applies only to "any action on a contract, where the contract specifically provides [for an award of] attorney's fees and costs, which are incurred to enforce that contract ...." (Italics added.) In such cases, the statute provides that the right of the prevailing party to attorney fees shall be reciprocal.
By its terms, therefore, Civil Code section 1717 has a limited application. It covers only contract actions, where the theory of the case is breach of contract, and where the contract sued upon itself specifically provides for an award of attorney fees incurred to enforce that contract. Its only effect is to make an otherwise unilateral right to attorney fees reciprocally binding upon all parties to actions to enforce the contract. (Brusso v. Running Springs Country Club, Inc., supra, 228 Cal. App.3d at pp. 101-108.) Civil Code section 1717 necessarily assumes the right to enter into agreements for the award of attorney fees in litigation, a right which it in fact derives from Code of Civil Procedure section 1021. Because of its more limited scope, Civil Code section 1717 cannot be said to supersede or limit the broad right of parties pursuant to Code of Civil Procedure section 1021 to make attorney fees agreements. It was therefore error for the trial court to conclude that Civil Code section 1717 would independently bar an award of attorney fees in this case because the causes of action argued at trial sounded in tort rather than in contract.
(2a) On appeal respondents acknowledge that an interpretation of Civil Code section 1717 is not an issue in the instant case, and that under proper circumstances attorney fees may be awarded pursuant to Code of Civil Procedure section 1021 in a tort action. They contend, however, that the trial court reached the right result because the Purchase Agreement did not "give rise" to the tort claims they asserted against appellants. We must therefore determine whether the language of the attorney fees provision in this case would permit an award of fees to appellants under the circumstances presented. (Mabee v. Nurseryland Garden Centers, Inc. (1979) 88 Cal. App.3d 420, 424 [152 Cal. Rptr. 31].)
The parties to the Purchase Agreement, "including Agent," agreed that the prevailing party would recover its attorney fees and costs in any "lawsuit or other legal proceeding" to which "this Agreement gives rise." The language of this provision does not limit an award of attorney fees to actions brought *1343 on a breach of contract theory, or to actions brought to interpret or enforce a contract. Neither does it limit attorney fees to the buyer and the seller, the principal parties to the real estate transaction. The language is broad enough to encompass both contract actions and actions in tort; and, by its express terms, it covers disputes involving the "Agent," that is, appellants.
That this interpretation accords with the intention of the parties is evidenced by respondents' inclusion in their complaint a request for attorney fees from all the defendants, including appellants. Contrary to respondents' contention on appeal, the complaint does not indicate that respondents were seeking attorney fees only in connection with their contract cause of action and not in connection with their tort claims, or that their attorney fees claim was limited to parties other than appellants. Despite the fact that their breach of contract cause of action was essentially dropped from the litigation, respondents never abandoned their demand for attorney fees under the Purchase Agreement until after trial, when it became clear that they were not to be the prevailing party.
The critical question, under the language of the parties' attorney fees agreement, is whether respondents' lawsuit arose from the Purchase Agreement. Appellants argue that the phrase "[i]f this Agreement gives rise to a lawsuit or other legal proceeding" (our italics) must be interpreted in a transactional sense; that is, in the sense that the litigation has arisen from the entirety of the circumstances of the real estate transaction of which the Purchase Agreement was the defining statement. Respondents, on the other hand, contend that their dispute with appellants cannot be said to have arisen from the Purchase Agreement, because the alleged actions, omissions, or misstatements with which that dispute was concerned, all occurred prior to the execution of the Purchase Agreement. In short, respondents focus on the chronology of the events in relation to the actual execution of the Purchase Agreement, while appellants more broadly address the entire transaction, of which the Purchase Agreement was the written memorandum.
In our opinion, this litigation may be viewed as having arisen from the Purchase Agreement, even under respondents' narrower interpretation of the subject provision. The terms of the Purchase Agreement and the addenda thereto provided that various structural and pest control inspections were to take place after the signing of the Purchase Agreement and before the close of escrow. The whole basis of respondents' claims against appellants, as set forth in the complaint, was that appellants had failed to conduct a competent and diligent inspection of the property, and that they handled the transaction negligently. It is clear that but for the Purchase Agreement by which the allegedly defective property was sold to respondents, the dispute between *1344 the parties would not have arisen. Certainly, but for the execution of the Purchase Agreement and the subsequent close of escrow, respondents would have had no basis on which to claim detrimental reliance or damages, as alleged in their lawsuit.
In any case, we must apply the rule that words in a contract are to be understood in their usual sense. (Civ. Code, § 1644.)[2] In our opinion, appellants' interpretation more fairly reflects the ordinary and usual sense of the phrase "gives rise to," which the parties agreed to in the Purchase Agreement. (3) In ordinary popular speech, as well as in legal opinions, it is common to use the phrase "arises from" or "arises out of" in a far more general, transactional sense than is suggested by phrases such as "derives from" or "proximately caused by." (Stout v. Turney (1978) 22 Cal.3d 718, 721, 730 [150 Cal. Rptr. 637, 586 P.2d 1228]; Smith, Valentino & Smith, Inc. v. Superior Court (1976) 17 Cal.3d 491, 497 [131 Cal. Rptr. 374, 551 P.2d 1206]; Malibou Lake Mountain Club, Ltd. v. Smith, supra, 18 Cal. App.3d at p. 35.)
(2b) Appellants' interpretation is also buttressed by the interpretational principle that a contract must be understood with reference to the circumstances under which it was made and the matter to which it relates. (Civ. Code, § 1647.) The circumstances of the Purchase Agreement and the matter to which it related was a large real property transaction, in which the buyer and the seller made certain reciprocal agreements with respect to the inspection of the premises and a variety of contingencies which were supposed to take place prior to the close of escrow. It was out of these contingencies, or the alleged failure thereof, that the lawsuit arose. The attorney fees provision specifically included the "Agent" among the parties with respect to which disputes could arise that would trigger a right to attorney fees. In light of all these circumstances, we conclude that the phrase "gives rise to" must be interpreted expansively, to encompass acts and omissions occurring in connection with the Purchase Agreement and the entire transaction of which it was the written memorandum.
In short, we conclude that the various tort causes of action set forth against appellants in respondents' complaint and tried before the jury must be said to have arisen from the Purchase Agreement. None of them was "quite independent of the basic contractual arrangement"; they arose from the underlying transactional relationship between the parties, as memorialized by the Purchase Agreement. (Malibou Lake Mountain Club, Ltd. v. *1345 Smith, supra, 18 Cal. App.3d at p. 35.) The order denying attorney fees must therefore be reversed so that an award of attorney fees and costs may be made to appellants as prevailing party, in accordance with the contractual attorney fees provision set forth in the Purchase Agreement.
The order denying the motion of appellants Marcus & Millichap and Thomas J. Coates for attorney fees is reversed, and the trial court is directed to make an award of reasonable attorney fees to appellants. Respondents shall pay appellants' costs on appeal, including reasonable attorney fees.
White, P.J., and Werdegar, J., concurred.
Respondents' petition for review by the Supreme Court was denied May 14, 1992. Mosk, J., did not participate therein.
NOTES
[1]  In pertinent part, Civil Code section 1717 provides as follows: "(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."
[2]  Civil Code section 1644 provides: "The words of a contract are to be understood in their ordinary and popular sense, rather than according to their strict legal meaning; unless used by the parties in a technical sense, or unless a special meaning is given to them by usage, in which case the latter must be followed."
