Whenever the Comptroller or the Treasurer of the Commonwealth shall notify the Attorney General, in writing, that they, or either of them, entertain such doubt respecting the proper construction or interpretation of any act of the General Assembly which appropriates or directs the payment of money out of the treasury of the Commonwealth, or respecting the constitutionality of any such act, that they, or either of them, do not feel that it would be proper or safe to pay such money until there has been a final adjudication by the Supreme Court determining any and all such questions, and that, for such reason, they will not make payments pursuant to such act until such adjudication has been made, the Attorney General may file in such court a petition for a writ of mandamus directing or requiring the Comptroller or Treasurer of the Commonwealth, or both, to pay such money as provided by any such act at such time in the future as may be proper. In order to avoid delays in payments after the time for making them has arrived, any such petition may be filed at any time after the passage of any such act although the time for making such payments has not arrived and no demand for such payments has been made. In any such proceeding the court shall consider and determine all questions raised by the Attorney General's petition pertaining to the constitutionality or interpretation of any such act, even though some of such questions may not be necessary to the decision of the question of the duty of such Comptroller and Treasurer of the Commonwealth to make payment of the moneys appropriated or directed to be paid.
The Comptroller and the Treasurer of the Commonwealth, or either of them, as the case may be, shall be made a party or parties defendant to any such petition and the court may, in its discretion, cause such other officers or persons to be made parties defendant as it may deem proper, and may make such order respecting the employment of an attorney or attorneys for any officer of the Commonwealth who is a party defendant as may be appropriate. The compensation of any such attorney shall be fixed by such court and upon its order paid out of the appropriation to the office or department of any such public officer represented by any such attorney in such proceeding.
Va. Code § 8.01-653