delivered the opinion of the Court.
In this appeal, we consider the nature and scope of a mandamus proceeding.
In May 1981, Richlands Medical Association (RMA) submitted an application to the State Health Commissioner, pursuant to the provisions of former Code §§ 32.1-93 to 32.1-102, inclusive, 2 for a certificate of need (the “certificate”) to construct a new hos *386 pital in Richlands. After various administrative proceedings, the Commissioner denied the application. RMA appealed the Commissioner’s determination to an independent hearing examiner designated by the Governor. See former Code § 32.1-97. After reviewing the record and taking additional evidence, the hearing examiner found that the Commissioner exceeded his discretion in evaluating the evidence, reversed the Commissioner’s decision, and directed that the certificate be issued to RMA.
Thereafter, the Commissioner filed with the trial court a petition for a writ of mandamus. The petition requested the court to issue a writ ordering the hearing examiner “to adhere to the law, to interpret properly the . . . Certificate of Public Need Law, to restrict his review to the function specified in [Code] § 32.1-97 . . ., to abandon his erroneous construction of the law, and to affirm the ... Commissioner’s original denial of the application. ...”
RMA contended at trial, as it does here, that mandamus does not lie. The trial court rejected this contention, reasoning that “[t]he interpretation of a statute is a ministerial act” subject to a writ of mandamus. The trial court granted appellees’ writ of mandamus, vacated the hearing examiner’s decision, and affirmed the Commissioner’s determination. Although RMA’s assignments of error raise a number of issues, the dispositive issue in this appeal is whether the trial court erred in holding that mandamus was a proper remedy and in issuing a writ of mandamus.
Mandamus is an extraordinary remedy employed to compel a public official to perform a purely ministerial duty imposed upon him by law.
Richmond-Greyhound Lines
v.
Davis,
When a public official is vested with discretion or judgment, his actions are not subject to review by mandamus.
Id.
As we stated in
Thurston
v.
Hudgins,
[I]t is well settled that mandamus will not lie to compel the performance of any act or duty necessarily calling for the *387 exercise of judgment and discretion on the part of the official charged with its performance. . . .
“[Wjhere the official duty in question involves the necessity on the part of the officer of making some investigation, and of examining evidence and forming his judgment thereon” mandamus will not lie.
The function of a trial court in a mandamus proceeding is to “command and execute, and not to inquire and adjudicate.”
Railroad Co.
v.
Fugate,
One of the marked characteristics of a proceeding by mandamus is that if the functionary whose conduct is complained of is by law to exercise any discretion, that discretion will not be controlled by a writ of mandamus; for that would be to transfer the discretion which the law commits to the functionary to the court which undertakes to award the writ.
Id.
at 372,
Additionally, mandamus is applied prospectively only; it will not be granted to undo an act already done.
Board of Supervisors
v.
Combs,
Finally, the extraordinary remedy of mandamus may not be used as a substitute for an appeal.
See Moon’s Administrator
v.
Wellford, Judge,
The hearing examiner’s powers and duties were prescribed in former Code § 32.1-97:
*388 The hearing examiner shall review the record and any additional evidence presented on behalf of the parties to the appeal. The review of the hearing examiner shall be limited to (i) whether there was substantial procedural compliance and (ii) whether the Commissioner exceeded his discretion in evaluating the evidence presented. The hearing examiner shall take due account of the presumption of official regularity, the experience and specialized competence of the Commissioner, and the purposes of the Medical Care Facilities Certificate of Public Need Law.
Clearly, former Code § 32.1-97 granted the hearing examiner wide discretion. He was authorized to evaluate the evidence from a review of the record. He also was authorized to take and consider additional evidence. The purpose of his review was to determine “whether the Commissioner exceeded his discretion in evaluating the evidence presented.” Thus, the hearing examiner was required to make a judgment in determining whether the Commissioner exceeded his discretion. Manifestly, the hearing examiner was not performing a ministerial act; he was discharging a quasi-judicial duty, weighing conflicting evidence, interpreting law, and applying law to facts.
See Rowe
v.
Drisgell,
Furthermore, the record discloses that the Commissioner in effect sought from the trial court by way of mandamus a judicial review of the entire administrative proceedings. The trial court conducted a comprehensive judicial review and granted the relief requested by the Commissioner. In so doing, the trial court substituted its judgment for that of the hearing examiner. This may not be done by mandamus.
Finally, the trial court issued the writ of mandamus to undo acts already done by the hearing examiner. As we stated previously, mandamus applies prospectively only; it may not be used to revise the hearing examiner’s completed acts. 3
We hold, therefore, that the trial court erred in ruling that mandamus would lie in this case and in granting the writ. Accord *389 ingly, we will reverse the judgment of the court, vacate the writ, and dismiss the petition.
Reversed, writ vacated, and petition dismissed.
