
639 S.E.2d 279 (2007)
Adam AFZALL, an Infant, by and through his Parents and Next Friends, Sophia Afzall and Stephen Afzall
v.
COMMONWEALTH of Virginia.
Record No. 060767.
Supreme Court of Virginia.
January 12, 2007.
*280 Gary B. Mims, Fairfax (Mary Catherine Sheridan; Zachary J. Desmond, on briefs), for appellant.
Stephen R. McCullough, Deputy State Solicitor General (Robert F. McDonnell, Attorney General; William E. Thro, State Solicitor General; William C. Mims, Chief Deputy Attorney General; Stephanie L. Hamlett, Deputy Attorney General; Chris Harris-Lipford, Senior Assistant Attorney General; J. David Taranto, Assistant Attorney General, on brief), for appellee.
Present: HASSELL, C.J., KEENAN, KOONTZ, KINSER, LEMONS, and AGEE, JJ., and CARRICO, S.J.
OPINION BY Senior Justice HARRY L. CARRICO.
Adam Afzall, an infant then nine years of age, was severely injured by the negligence of a third party. The Department of Medical Assistance Services (DMAS), the Commonwealth's provider of benefits under the national Medicaid program, paid $419,809.56 for a portion of the costs of Adam's treatment related to those injuries. Adam, by his parents and next friends, Sophia and Stephen Afzall, brought an action against the third *281 party alleging the third party's negligence caused Adam's injuries. The parties settled the case, which was approved by the trial court on September 3, 2004.
By letter dated December 3, 2004, the Commonwealth claimed a lien for the amount DMAS paid for Adam's care. Adam's counsel computed the "Commonwealth's share" of Adam's expenses for legal fees and costs at $142,017.62 in obtaining the settlement.[1] Counsel submitted a check to the Office of the Attorney General for $277,791.94, representing the amount DMAS paid less the proportionate amount of Adam's legal fees and costs, "in full satisfaction of [the] lien." The Office of the Attorney General returned the check with a demand for payment of the full lien in the amount of $419,809.56.
Adam, by his parents and next friends, then filed a motion for declaratory judgment against the Commonwealth, seeking a declaration that the "Commonwealth's share" of his expenses for legal fees and costs in obtaining settlement of his negligence case should be deducted from the amount of the lien.
In support of his position, Adam cited a provision in the second paragraph of Code § 8.01-66.9, which, after establishing liens for payments made by DMAS and other institutions for persons who sustain personal injuries, provides as follows:
The Commonwealth's or such Department's or institution's lien shall be inferior to any lien for payment of reasonable attorney's fees and costs, but shall be superior to all other liens created by the provisions of this chapter and otherwise. Expenses for reasonable legal fees and costs shall be deducted from the total amount recovered.
Adam argued in the trial court that a plain reading of Code § 8.01-66.9 dictates that a plaintiff's legal fees and costs must be deducted from DMAS's share of any recovery. The Commonwealth argued that the statute did not require any deduction. The trial court rejected Adam's argument and dismissed his motion for declaratory judgment. We awarded Adam this appeal.
Adam makes the same argument on appeal as he made in the trial court. However, for the first time, the Commonwealth interposes an argument that "[s]overeign immunity bars a declaratory judgment against the Commonwealth or its agencies."
The Commonwealth concedes that it did not raise the doctrine of sovereign immunity in the trial court or in its brief in opposition to Adam's petition for appeal, but it asserts that the failure to raise the issue at an earlier time does not constitute the Commonwealth's waiver of its sovereign immunity, citing Commonwealth v. Luzik, 259 Va. 198, 206-07, 524 S.E.2d 871, 877 (2000) (failure to assign cross-error to trial court's denial of claim of sovereign immunity cannot constitute waiver of claim). Adam does not question the timeliness of the Commonwealth's argument concerning the doctrine of sovereign immunity, but he contends sovereign immunity does not apply in this case.
We agree that the Commonwealth can raise the defense of sovereign immunity for the first time on appeal because if sovereign immunity applies, the court is without subject matter jurisdiction to adjudicate the claim. Id. at 206-07, 524 S.E.2d at 876-77. "[O]nly the legislature acting in its policy-making capacity can abrogate the Commonwealth's sovereign immunity." Id. at 206, 524 S.E.2d at 876. A "`waiver of immunity cannot be implied from general statutory language'" but must be "`explicitly and expressly announced'" in the statute. Hinchey v. Ogden, 226 Va. 234, 241, 307 S.E.2d 891, 895 (1983) (quoting Elizabeth River Tunnel Dist. v. Beecher, 202 Va. 452, 457, 117 S.E.2d 685, 689 (1961)).
In the absence of such a waiver by the legislature, the courts of this Commonwealth wealth do not have the necessary jurisdiction "to entertain [an] action." Luzik, 259 Va. at 206, 524 S.E.2d at 877. Such subject matter jurisdiction cannot be waived by the Commonwealth or given to a court by agreement *282 or inaction of the parties. Subject matter jurisdiction
can only be acquired by virtue of the Constitution or of some statute. Neither the consent of the parties, nor waiver, nor acquiescence can confer it. Nor can the right to object for a want of it be lost by acquiescence, neglect, estoppel or in any other manner. . . . and the want of such jurisdiction of the trial court will be noticed by this court ex mero motu.

Board of Supervisors v. Board of Zoning Appeals, 271 Va. 336, 344, 626 S.E.2d 374, 379 (2006) (quoting Humphreys v. Commonwealth, 186 Va. 765, 772-73, 43 S.E.2d 890, 894 (1947)).
"As a general rule, the Commonwealth is immune both from actions at law for damages and from suits in equity to restrain governmental action or to compel such action." Alliance to Save the Mattaponi v. Commonwealth, 270 Va. 423, 455, 621 S.E.2d 78, 96 (2005). "[T]he doctrine of sovereign immunity serves a multitude of purposes including but not limited to protecting the public purse, providing for smooth operation of government, eliminating public inconvenience and danger that might spring from officials being fearful to act, assuring that citizens will be willing to take public jobs, and preventing citizens from improperly influencing the conduct of governmental affairs through the threat or use of vexatious litigation." Messina v. Burden, 228 Va. 301, 308, 321 S.E.2d 657, 660 (1984).
Sovereign immunity may also bar a declaratory judgment proceeding against the Commonwealth. Virginia Bd. of Med. v. Virginia Physical Therapy Ass'n, 13 Va.App. 458, 413 S.E.2d 59 (1991)(VBM I), aff'd, 245 Va. 125, 427 S.E.2d 183 (1993)(VBM II). VBM I involved a bill of complaint for declaratory judgment filed by the Virginia Physical Therapy Association (the VPTA) against the Virginia Board of Medicine (the Board) for declaratory and injunctive relief against the enforcement of any rule prohibiting the use of electromyographic examinations by physical therapists. The trial court granted the relief sought by VPTA, and the Board appealed.
The dispositive question before the Court of Appeals was whether "the circuit court had subject matter jurisdiction to hear the case." Id. at 460, 413 S.E.2d at 61. The Court of Appeals determined that the jurisdiction issue turned on "the relationship between judicial review of the Board's actions and the doctrine of sovereign immunity." Id. at 464, 413 S.E.2d at 63.
The Court of Appeals noted that in the Virginia Administrative Process Act (VAPA),
the General Assembly has waived sovereign immunity only to allow a party to obtain judicial review of the Board's adoption of rules or the Board's case decisions, as such are defined in the VAPA, in the manner provided in the VAPA. In short, the Board has consented to and may be sued only for its promulgation of a rule or its decision of a case, as both are defined in the VAPA. The VPTA's right to bring a declaratory judgment action and in turn the court's jurisdiction to exercise jurisdiction over the action must be founded on the provisions of Code § 9-6.14:16(A) and fall within the explicit and limited waiver of sovereign immunity contained in that Code section.[[2]]
Id. at 466, 413 S.E.2d at 64. The relief provided by then Code § 9-6.14:16(A) against the unlawfulness of a regulation or a case decision was by an "appropriate and timely court action against the agency . . . in the manner provided by the rules of the Supreme Court of Virginia."
The Court of Appeals noted that this Court in Kenley v. Newport News Gen. & Non-Sectarian Hosp. Ass'n, 227 Va. 39, 314 S.E.2d 52 (1984), had concluded that, as Code § 9-6.14:16 then read, a motion for declaratory judgment used to accomplish the purpose of a direct appeal of a pending case was an available procedure for that purpose. VBM I, 13 Va.App. at 468, 413 S.E.2d at 65. The Court of Appeals noted further that, subsequent to the decision in Kenley, Code § 9-6.14:16 had been revised by the General Assembly and no longer contained the "`imprecise *283 language'" that prompted the decision in Kenley. In fact, what was removed from Code § 9-6.14:16 was this telling sentence: "Such proceedings include those for declaratory judgments." Kenley, 227 Va. at 46, 314 S.E.2d at 56.
The Court of Appeals stated that, "[i]n its present form, Code § 9-6.14:16 clearly provides that the procedural steps for obtaining court review of agency actions adopting a rule or rendering a case decision are the procedural steps provided by the Rules of the Supreme Court." VBM I, 13 Va.App. at 468-69, 413 S.E.2d at 65. Part Two A of the Rules of the Supreme Court of Virginia governs "Appeals Pursuant to the Administrative Process Act." Notably lacking in these Rules is any mention of the use of a motion for declaratory judgment as a means of obtaining judicial review of an agency's adoption of regulations or its case decisions. Accordingly, the Court of Appeals reversed the judgment of the trial court "[b]ecause [it] found the circuit court lacked jurisdiction to hear the case." VBM I, 13 Va.App. at 469, 413 S.E.2d at 66.
This Court awarded VPTA an appeal "to consider the question whether the Court of Appeals erred in holding that the circuit court lacked subject matter jurisdiction." We said that we had "considered this question and, for the reasons assigned by the Court of Appeals in its opinion, we will affirm its judgment." VBM II, 245 Va. at 126, 427 S.E.2d at 184.
Adam argues that VBM I is distinguishable from the case at bar. He contends the only similarity between the two cases is that the plaintiffs in both filed for declaratory judgments and the Commonwealth was a party to both. Unlike the plaintiff in VBM I, Adam says, he does not "attempt to challenge the rules of a governmental agency or otherwise to interfere with governmental functions." Nor, Adam continues, does he "attempt to improperly influence the conduct of governmental affairs through the threat or use of vexatious litigation or for damages against the government or to restrain or compel it to act." What he has sought, Adam concludes, is "a judicial interpretation not of the government's right to recover its statutory lien, but to determine what the Legislature meant when it drafted the very statute that created the lien."
We agree with the Commonwealth that VBM I governs the outcome of this case and is not distinguishable. The close similarity between this case and VBM I is that in each case the plaintiff seeks to compel the Commonwealth to take certain actions: in VBM I to refrain from enforcing a rule against the use of electromyographic examinations by physical therapists and in this case to require a reduction in the amount of the Commonwealth's lien for payments made for Adam's treatment. Both would have the effect of interfering with governmental functions and, in Adam's case, the adverse effect upon "protecting the public purse." Messina, 228 Va. at 308, 321 S.E.2d at 660.
In any event, the ultimate question in this case is whether Code § 8.01-66.9, upon which Adam relies, evinces an intention on the part of the General Assembly to waive sovereign immunity so as to permit a party to seek judicial review by way of a motion for declaratory judgment of action taken pursuant to that Code section. The second paragraph of Code § 8.01-66.9 makes the Commonwealth's lien "inferior to any lien for payment of reasonable attorney's fees and costs" but "superior to all other liens created by the provisions of this chapter," with "[e]xpenses for reasonable legal fees and costs [deductible] from the total amount recovered."
We find nothing in the language of this paragraph of Code § 8.01-66.9 that evinces such an intention. But, as the Commonwealth points out, another paragraph of Code § 8.01-66.9 makes it clear that when the General Assembly intends to waive sovereign immunity and provide a particular procedure for an injured person to follow in seeking judicial review, it knows how to demonstrate that intention. The final paragraph of the statute provides that "[t]he court in which a suit by an injured person . . . has been filed against the person . . . alleged to have caused such injuries or in which such suit may properly be filed, may, upon motion or petition by the injured person, . . . after written notice is given to those holding liens *284 attaching to the recovery, reduce the amount of the liens and apportion the recovery . . . between the plaintiff, the plaintiff's attorney, and the Commonwealth or such Department or institution as the equities of the case may appear." Consequently, we conclude the bar of sovereign immunity applies in this case because the Commonwealth has not waived that defense in the context of a declaratory judgment action within the purview of Code § 8.01-66.9.
Since sovereign immunity applies in this case, the trial court was without jurisdiction to adjudicate Adam's claim. Therefore, we will dismiss the appeal and enter final judgment in favor of the Commonwealth.
Dismissed and final judgment.
NOTES
[1]  The record shows that Adam's legal fees were based upon "one-third of the gross recovery, the amount of which is confidential."
[2]  Code § 9-6.14:16(A), part of the former Virginia Administrative Process Act, was repealed by Acts 2001 ch. 844 and is now Code § 2.2-4026, part of the present Administrative Process Act.
