
    The PORT OF STOCKTON, Plaintiff-Appellant, v. WESTERN BULK CARRIER KS; Western Bulk Carriers (Seattle) Inc., Defendants-Appellees.
    No. 02-16221.
    United States Court of Appeals, Ninth Circuit.
    Argued and Submitted Sept. 10, 2003.
    Filed June 15, 2004.
    George J. Koelzer (argued) and James P. Koelzer, Los Angeles, CA, for the appellant. .
    Mitchell S. Griffin (argued)- and Gregory W. Poulos, San Francisco, CA, for the appellee.
    Before SCHROEDER, Chief Judge, O’SCANNLAIN, and TASHIMA, Circuit Judges.
   O’SCANNLAIN, Circuit Judge.

We must decide whether a party who failed properly to seek attorneys’ fees in one action may bring a separate claim for them in another.

I

On January 27, 1997, the MTV AKTEA, a ship chartered by Western Bulk Carriers (“WBC”) to carry sulfur, ran aground on a shoal in a deep water ship channel shortly after weighing anchor from the Port of Stockton (“the Port”). Once freed from the bottom of the waterway, excess sedimentary deposits required the ship to return to the Port and remain docked for 45 days while the channel was dredged. The delay allegedly cost WBC several hundred thousand dollars, and so on December 24, 1997, it filed multiple claims against the Port in the Eastern District of California, many of them arising from the “Port Tariff,” or berthing contract between the parties.

In its complaint, WBC sought additional compensation pursuant to Item 48 of the Tariff, which states that “the prevailing party in [an action on the Tariff] shall be entitled to recover of its costs and reasonable attorneys’ fees.” The Port, however, declined to file an analogous counterclaim for its potential costs and fees, and soon after, each party represented to the court that it would not make further amendments to its pleadings. Accordingly, the court issued a Federal Rule of Civil Procedure 16(b) Pretrial Scheduling Order.

Some time later, the Port moved to amend its answer to include a counterclaim for costs and attorneys’ fees. The court denied the motion on September 14, 1999, holding that the Port had not demonstrated the good cause required under Rule 16(b), and then proceeded to enter summary judgment for the Port on all substantive counts. The Port did not take an appeal from the judgment in that case.

Almost two years after prevailing in the contract action, the Port commenced this suit in the Western District of Washington on June 14, 2001. Again invoking Item 48 of the Port Tariff, it sought $192,969.19 in costs 'and attorneys’ fees that it had allegedly incurred in the earlier suit. Upon transfer of the case to the Eastern District of California, WBC moved for summary judgment on the grounds that the Port’s claim, as part of the same transaction or occurrence of the prior suit, was a compulsory counterclaim according to Rule 13(a), and so should have been filed in the initial contract action. The district court agreed, and dismissed the case as res judicata. The Port timely appeals.

II

In this admiralty case, federal principles of claim preclusion apply, and the dispute thus far has centered on the scope of the “compulsory counterclaim” provision of Federal Rule of Civil Procedure 13(a). The Port asserts that its entitlement to attorneys’ fees was wholly contingent upon its success in the contract case, so any such claim did not accrue until that judgment issued and the Port became the “prevailing party.” For this reason, the Port argues that it was error to dismiss because it could not have filed a counterclaim in the prior case at all, rendering this subsequent action necessary.

But the Federal Rules of Civil Procedure not only govern the compulsory counterclaim issue; they also establish the method by which a federal litigant must obtain attorneys’ fees in the first place. Each party has assumed that some form of initial pleading — either a complaint or a counterclaim — is the appropriate manner by which the Port should seek its costs. Yet, such is not generally the case in our federal system. Federal Rule of Civil Procedure 54(d)(2)(A) establishes that “[c]laims for attorneys’ fees and related nontaxable expenses shall be made by motion unless the substantive law governing the action provides for the recovery of such fees as an element of damages to be proved at trial.” (emphasis added). And the Rules make clear that pleadings and motions are distinct. Compare Fed. R.Civ.P. 7(a) (defining “Pleadings,” including counterclaims), with Fed.R.Civ.P. 7(b) (defining “Motions and Other Papers”). So unless this case falls under Rule 54’s “substantive law” exception, the Port need not, nor should it, have filed a counterclaim or a complaint at all.

The question, then, is whether the exception applies, i.e. whether the substantive law governing the underlying contract claim required the Port to prove its entitlement to attorneys’ fees “as an element of damages ... at trial.” Fed.R.Civ.P. 54(d)(2)(A). As noted, the Port’s underlying claim for fees arises from a provision of the Port Tariff. Item 41 of the same Tariff declares that California law governs the agreement, and we interpret the attorneys’ fee agreement according to the parties’ stated choice-of-law preference. See Chan v. Soc’y Expeditions, Inc., 123 F.3d 1287, 1296-97 (9th Cir.1997) (“[W]here the parties specify in their contractual agreement which law will apply, admiralty courts will generally give effect to that choice.”).

Under California law, contractual attorneys’ fee provisions are generally enforceable. Cal.Civ.Proc.Code § 1021 (“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.... ”). In order to “limit the ability of a dominant contracting party to provide for a right to attorney’s fees on only one side of an agreement,” Sears v. Baccaglio, 60: Cal.App.4th 1136, 1144, 70 Cal.Rptr.2d 769 (1998), California Civil Code § 1717(a) deems that such clauses “entitle[ ]” a prevailing party to “[reasonable attorney’s fees,” no matter which party is specified in the contract. And perhaps in an effort to avoid the sticky pleading problems presented by the parties here, § 1717(a) provides that such fees “shall be fixed by the court, and shall be an element of the costs of the suit.” According to the substantive law governing the Port’s claim for attorneys’ fees, then, they are not “an element of damages to be proved at trial.” Fed.R.Civ.P. 54(d)(2)(A). Rather, they are simply cognizable as costs.

Rule 54’s lone exception therefore does not apply, to this case. In fact, Rule 54 anticipates one of the Port’s main arguments: that it was not entitled to the fees until judgment issued and it became a prevailing party. Rule 54(d)(2)(B) instructs a party to file a motion for attorneys’ fees “after entry of judgment.” (emphasis added). Even under the Port’s theory, its claim for attorneys’ fees vested at least upon entry of judgment in the underlying contract case, so nothing should have prevented it from filing a Rule 54 motion thereafter.

Yet the Port simply failed to include a request for attorneys’ fees in any cost bill it may have filed in the original contract case. Neither did the Port take any other action that conceivably could stay the entry of that judgment. Indeed, it failed even to appeal the original denial of its motion to amend its pleadings to include a claim for attorneys’ fees. By failing to file an appropriate motion within the relevant time limit, to say nothing of failing to appeal from the underlying judgment, the Port waived any claim to attorneys’ fees arising out of the original litigation, and therefore cannot recover them in this new action. See Kona Enters., Inc, v. Estate of Bishop, 229 F.3d 877, 889-90 (9th Cir.2000) (holding that defendants waived rights ■ to attorney fees by failing to file Rule 54(b) motion within time limit after entry of judgment).

AFFIRMED. 
      
      . Normally, a litigant has 14 days to file a motion for attorneys’ fees. Fed.R.Civ.P. 54(d)(2)(B). Here, however, the underlying contract claim was filed in the Eastern District of California, where Local Rule 54-293(a) specifies that "[mjotions for awards of attorneys’ fees to prevailing parties pursuant to statute shall be filed not later than thirty (30) days after entry of final judgment.” At oral argument, counsel for the Port acknowledged that he had not filed such a motion because he had "waited for instructions from clients, frankly,” and apparently did not hear back within the 30-day time frame.
     
      
      . Although the district court dismissed on the basis of res judicata,, we affirm on these alternate grounds. See Branson v. Nott, 62 F.3d 287, 291 (9th Cir.1995) (“We may affirm the • decision of the district court on any basis which the record supports.”).
     