The opinion of the court was delivered by: Mitchell, Chief Justice.
On discretionary review pursuant to N.C.G.S. § 7A-31 of a unanimous decision of the Court of Appeals, 126 N.C. App. 241, 485 S.E.2d 61 (1997), affirming in part, reversing in part, and remanding an order entered by Winner, J., on 9 February 1996 in Superior Court, Mecklenburg County. Heard in the Supreme Court 18 November 1997.
The question presented for review is whether the doctrine of sovereign immunity bars recovery in quantum meruit upon an action based on a contract implied in law against the State of North Carolina. We conclude that a contract implied in law is insufficient to constitute a waiver of sovereign immunity. We therefore reverse the decision of the Court of Appeals.
Plaintiff made the following allegations in the complaints filed for this action. Plaintiff is a professional association, and plaintiff's attorney, Paul F. Whitfield, is the principal attorney in the professional association. Defendant Peter S. Gilchrist is the District Attorney for the Twenty-Sixth Judicial District of North Carolina, which includes the City of Charlotte. Since 1967, Mr. Whitfield has brought various public nuisance actions within the City of Charlotte under chapter 19 of the General Statutes of North Carolina. Defendant Gilchrist engaged plaintiff Whitfield to file two public nuisance actions, one of which was against the Downtown Motel Corporation, a North Carolina corporation, known as the Downtown Motor Inn and located on North Tryon Street in the City of Charlotte (Downtown Motel action). The second action was against Ashak Patel, Mani, Inc., a North Carolina corporation, doing business as Alamo Plaza Hotel Courts, Alamo Plaza Courts & Alamo Amusements, et al., in the City of Charlotte (Alamo action). In the investigation and preparation for both of these actions, plaintiff worked continuously with defendant Gilchrist as District Attorney and with members of the Charlotte Police Department. As a consequence of plaintiff's legal efforts, the public nuisances were abated. The Charlotte-Mecklenburg community, the public at large, and the State have benefitted, and plaintiff expected to be paid for its legal services.
On 28 July 1995, plaintiff filed a complaint alleging that it was entitled to recover from defendants, on the basis of quantum meruit, attorney's fees and costs for legal services it provided in the Downtown Motel public nuisance action. On 20 September 1995, defendants filed an answer and a motion to dismiss.
On 23 October 1995, plaintiff filed a second complaint with similar allegations seeking recovery in quantum meruit for its services in the Alamo action. Defendants filed a motion to consolidate the two cases on 26 October 1995. On 20 November 1995, defendants filed an answer and a motion to dismiss in the Alamo action.
The motions were heard at the 18 January 1996 Civil Session of Superior Court, Mecklenburg County. On 9 February 1996, the trial court entered an order allowing the consolidation of the two cases. In that same order, the trial court dismissed both actions, concluding that sovereign immunity is a complete defense to plaintiff's actions. Plaintiff then appealed to the Court of Appeals.
The Court of Appeals affirmed the trial court's dismissal of plaintiff's claims against defendant Gilchrist. Paul L. Whitfield, P.A. v. Gilchrist, 126 N.C. App. 241, 251, 485 S.E.2d 61, 67 (1997). The Court of Appeals reversed the trial court's dismissal of plaintiff's claims against defendant State of North Carolina and remanded the case for further proceedings with regard to those claims against the State. Id.
On 23 June 1997, defendant State petitioned this Court for discretionary review seeking to have this Court resolve a single issue: "Did the Court of Appeals err in holding that sovereign immunity is not available to the State as a defense to a pleading alleging a claim based on a quasi-contract implied in law which totally fails to comply with the applicable statutory requirements?" On 23 July 1997, this Court entered an order allowing discretionary review. Our appellate review here is limited solely to the single issue brought forward by defendant State in its petition for discretionary review.
Defendant State contends that the Court of Appeals erred in reversing the trial court's dismissal of plaintiff's claims against the State of North Carolina because sovereign immunity bars recovery on the basis of quantum meruit in an action against the State upon a quasi contract or contract implied in law. We agree.
It has long been the established law of North Carolina that the State cannot be sued except with its consent or upon its waiver of immunity. Guthrie v. N.C. State Ports Auth., 307 N.C. 522, 534, 299 S.E.2d 618, 625 (1983). This Court has held, however, that "whenever the State of North Carolina, through its authorized officers and agencies, enters into a valid contract, the State implicitly consents to be sued for damages on the contract in the event it breaches the contract." Smith v. State, 289 N.C. 303, 320, 222 S.E.2d 412, 423-24 (1976). In the decision below, the Court of Appeals improperly expanded Smith to hold that sovereign immunity does not bar an action seeking recovery in quantum meruit based on an implied-in-law contract theory. Whitfield, 126 N.C. App. at 248, 485 S.E.2d at 67.
Quantum meruit is a measure of recovery for the reasonable value of services rendered in order to prevent unjust enrichment. Potter v. Homestead Preservation Ass'n, 330 N.C. 569, 578, 412 S.E.2d 1, 7 (1992); see also Dan B. Dobbs, Dobbs Law of Remedies § 4.2(3) (2d ed. 1993). It operates as an equitable remedy based upon a quasi contract or a contract implied in law. Potter, 330 N.C. at 578, 412 S.E.2d at 7. "A quasi contract or a contract implied in law is not a contract." Booe v. Shadrick, 322 N.C. 567, 570, 369 S.E.2d 554, 556 (1988). An implied contract is not based on an actual agreement, and quantum meruit is not an appropriate remedy when there is an actual agreement between the parties. Id. Only in the absence of an express agreement of the parties will courts impose a quasi contract or a contract implied in law in order to prevent an unjust enrichment. Id.
We will not imply a contract in law in derogation of sovereign immunity. In Smith, we held that when the State, acting through officers and agencies authorized by law, enters into a valid contract, it implicitly waives its sovereign immunity and consents to be sued for damages upon its breach of the contract. Smith, 289 N.C. at 320, 222 S.E.2d at 423-24. We emphasized, however, that "[t]he State is liable only upon contracts authorized by law. When it enters into a contract it does so voluntarily and authorizes its liability. Furthermore, the State may, with a fair degree of accuracy, estimate the extent of its liability for a breach of contract." Id. at 322, 222 S.E.2d at 425 (emphasis added). Consistent with the reasoning of Smith, we will not first imply a contract in law where none exists in fact, then use that implication to support the further implication that the State has intentionally waived its sovereign immunity and consented to be sued for damages for breach of the contract it never entered in fact. Only when the State has implicitly waived sovereign immunity by expressly entering into a valid contract through an agent of the State expressly authorized by law to enter into such contract may a plaintiff proceed with a claim against the State upon the State's breach. Id.
The State has not authorized its district attorneys to contract for payment of fees for attorneys' services of any type. To the contrary, as we explain hereinafter, the legislature has provided that such contracts may be entered only by, or with the approval of, other agents of the State. We certainly will not imply a contract in law where there is a statute to the contrary.
It is important to recognize that there are situations in which a district attorney may obtain the assistance of private counsel. For example, an elected district attorney has the discretion to permit a private attorney to appear with him to represent the State's interest in an action, subject to the court's approval. State v. Camacho, 329 N.C. 589, 593, 406 S.E.2d 868, 871 (1991). Historically, however, private counsel functioning in this prosecutorial capacity either have been paid by private parties or have appeared pro bono publico. See State v. Best, 280 N.C. 413, 186 S.E.2d 1 (1972). A district attorney's discretion to permit an attorney to act as a private prosecutor on behalf of the State in the prosecution of a ...