OPINION
In this сase we must decide whether, when a governmental entity brings suit for declaratory relief, the defendant as the prevailing party may recover attorney’s fees from the governmental entity. Appellant- TML Intergovernmental Employee Benefits Pool (“the Pool”) contends in one issue that governmental immunity bars the award of attorney’s fees to appellee Prudential Insurance Company of America. *603 Because we hold that the Pool’s initiation of suit waived immunity from suit and that its request for declaratory relief under the Uniform Declaratory Judgments Act (“UDJA”) waived immunity from liability for attorney’s fees, we affirm the order of the district court.
BACKGROUND
The pertinent facts of this case are not in dispute. The Pool was created to provide health benefits coverage to employees of political subdivisions. See Tex. Gov’t Code Ann. ch. 791 (West 1994 & Supp. 2004); Tex. Loc. Gov’t Code Ann. ch. 172 (West 1999 & Supp.2004). On September 29, 1998, the City of Denison changed its health benefits coverage fоr its employees from Prudential to the Pool. Prudential’s contract with the City provided for an extension of health care benefits beyond the termination of the contract, for a maximum of three months, to a person who is totally disabled and under a doctor’s care.
At the time of this transition in cоverage, an employee of the City of Denison was hospitalized and in need of a heart transplant. She remained hospitalized for several months and received the transplant in April 1999. Both Prudential and the Pool paid the employee’s medical expenses for the last three months of 1998. The Pool filed a claim for its payments with its excess loss insurance coverage carrier, Life Insurance Company of North America (“LINA”). See Tex. Loc. Gov’t Code Ann. § 172.008(a) (West 1999) (“A risk pool may purchase excess loss coverage or reinsurance to insure a pool against financiаl losses that the pool determines might place the solvency of the pool in financial jeopardy.”). LINA denied the claim.
In January 2001, the Pool filed suit against LINA and Prudential, asserting that LINA had breached its contract and requesting a declaration that the extension of benefits clause in Prudentiаl’s policy with the City “does not provide insurance coverage for [the employee’s] claim.” The Pool also sought attorney’s fees pursuant to its request for declaratory relief. At the time it filed suit, the Pool deposited into the registry of the court approximately $348,000 that the hospital returned as an overpayment. In June and August 2001, the parties agreed to distribute $220,000 to the hospital and the remaining $128,000 to Prudential, which represented the amount that Prudential paid toward the employee’s medical expenses for the last three months of 1998.
In February 2002, the Pool filed an amended petition, requesting a declaration of whether Prudential’s policy “does or does not provide insurance coverage for [the employee’s] claim.” Prudential then filed a motion for summary judgment, seeking a declaration that its policy does not provide coverage. The Pool and LINA filеd motions for partial summary judgment seeking a declaration that Prudential’s policy does provide coverage. In June 2002, Prudential filed an amended answer in which it asserted a claim for attorney’s fees pursuant to the UDJA. Tex. Civ. Prac. & Rem.Code Ann. § 37.009 (West 1997).
The district court granted Prudential’s motion for summary judgment and denied the Pool’s аnd LINA’s motions. Soon afterward, Prudential filed a motion to recover attorney’s fees from the Pool on the ground that it was the prevailing party in the declaratory judgment action. The Pool responded that as a political subdivision of the State, it is immune from liability. The Pool also asserted that bеcause it had acted in good faith, the district court should exercise its discretion and not award attorney’s fees. Prudential responded that the Pool waived immunity from liability by seeking a declaration of *604 its rights under the UDJA, initiating suit against Prudential, and failing to plead the affirmative defense of immunity from liability. After a hеaring on the motion and response, the district court granted Prudential’s motion and ordered that the Pool pay Prudential’s attorney’s fees in part. It is from this order that the Pool appeals. 1
ANALYSIS
In one issue, the Pool contends that the district court erred in awarding attorney’s fees to Prudential under the UDJA bеcause the Pool, as a political subdivision, is immune from paying a money judgment. Whether the Pool is entitled to immunity is a question of law.
Harris County v. Louvier,
Governmental immunity encompasses two principles: immunity from suit and immunity from liability.
Texas Natural Res. Conservation Comm’n v. IT-Davy,
Immunity from liability protects a governmental entity from judgment even if the legislature has expressly consented to the suit.
Texas Dep’t of Transp. v. Jones,
Second, Prudential contends that the Pool waived immunity from liability by failing to raise its affirmative defense in a pleading. Citing
Davis v. City of San Antonio,
Prudential argues specifically that the Pool’s assertion of the affirmative defense in its response to Prudential’s motion for attorney’s fees was insufficient.
When construing a statute, we must ascertain and give effect to the legislature’s intent.
See Fleming Foods v. Rylander,
The Pool asserts that immunity from liability is waived
only
when a UDJA action concerns construction of a legislative enactment.
See City of La Porte v. Bar
*606
field,
Here, the governmental entity asserted the action. The supreme court has allowed an award of attorney’s fees to a defendant in a UDJA action brought by a governmental entity, although the issue of immunity from liability was not before the court.
Duncan v. Pogue,
Embеdded in the sovereign immunity doctrine is the protection of raids on the public treasury.
Texas Mun. Power Agency v. Public Util. Comm’n,
The purpose of the UDJA is “to settle and to afford relief from uncertainty and insecurity with respect to rights, status, and other lеgal relations.” Tex. Civ. Prac. & Rem.Code Ann. § 37.002(b) (West 1997). The UDJA is to be “liberally construed and administered.” Id. The Pool, as a party whose rights were affected by the contract, asserted a UDJA action to determine whether a provision in Prudential’s insurance contract with the City of Deni-son provided extended benefits coverage for the employee’s claim. Id. § 37.004(a) (West 1997). The Pool had an interest in this determination because it succeeded Prudential as the provider of health benefits coverage. “When declaratory relief is sought, all persons who have or claim any interest that would be affected by the declaration must be made parties.” Id. § 37.006(a) (West 1997). Thus, even though the Pool’s actions for damages were against its excess loss insurance carrier, the Pool was required to include Pru *607 dential as a party affected by the declaration.
In “any proceeding” under the UDJA, “the court
may
award costs and reasonable and necessary attorney’s fees as are equitable аnd just.”
Id.
§ 37.009 (emphasis added). The UDJA “entrusts attorney fee awards to the' trial court’s sound discretion, subject to the requirements that any fees awarded be reasonable and necessary, which are matters of fact, and to the additional requirements that fees be equitable and just, which are matters of law.”
Bocquet v. Herring,
To hold that a governmental entity, as plaintiff in a UDJA action, is immune from liability as to a prevailing defendant’s attorney’s fees would give governmental entities license to pursue UDJA actions with impunity and disregard the statutory authorization for attorney’s fees in “any proceeding” under the UDJA. Tex. Civ. Prac. & Rem.Cоde Ann. § 37.009. Here, the parties agree that the district court has subject matter jurisdiction. In light of the policies of and protections embodied in the UDJA, we hold that when a governmental entity brings suit for declaratory relief, the UDJA waives immunity from liability as to the defendant’s reasonable, necessary, equitable, and just attorney’s fees. Accordingly, we overrule the Pool’s issue and affirm the order of the district court.
CONCLUSION
When the Pool brought an action for declaratory relief against Prudential, it waived immunity from suit as to Prudential’s request for attorney’s fees under the same statute.
See Kinnear,
Notes
. LINA is no longer a party because it settled with the Pool in the proceedings below.
