At an election held in Wyoming county August 28, 1915, ordered by the county court upon the petition of the requisite number of legal voters, a county bond issue of $550,000 was authorized for the improvement of certain public roads, according to the provisions of §56a25a, ch. 43, Barnes’ Code. The regularity of the election and authorization, issuance and sale of the bonds is not a controverted question.
Of the bond issue the state purchased at par $250,000, and Powell, Garard & Company $300,000, paying therefor' the face value and interest accruing between the dates of issuance and purchase, the bonds so purchased to bear interest at the rate of five per centum per annum. The proceeds of the sale to the state, it is alleged and not denied, were deposited in all respects agreeably to the requirements of chapter 84, acts 1915. The proceeds of the sale to Powell, Garard *766& Company were also deposited, but not as required by that act. As to. them the county court arrogated to itself the right to make, and it did make, a wholly different arrangement, and caused the deposit thereof without interest in the same banks and in others than those designated by the sheriff as county depositories. That tribunal, by its orders duly entered • of record, conformably with a written agreement therefor, not of record, between itself' and such banks, expressly directed and required these proceeds to be deposited therein upon non-interest bearing deposit certificates payable to the sheriff in his official character. .The maturity of the certificates ranged from July 1, 1917, to July 1, 1918. According to such agreement the certificates do not purport to bear interest before or after their due dates, nor at any time so long as the funds placed with the several banks remained therein. On the contrary, it was a constituent covenant of the agreement that, no matter how long the banks retained the money so deposited, they were not required to pay any interest thereon.
The alternative writ, awarded upon the petition of N. C. Bunch and others as resident taxpayers of the county, commanded Charles Short, the sheriff, forthwith to deposit the $300,000 derived from the sale to Powell, Garard & Company upon three per cent interest in the Citizens National Bank of Pineville, the First National Bank of Pineville, the Bank of Mullens and the Bank of 'Wyoming, all located within Wyoming.county and the qualified depositories thereof, or so much of the funds, in excess of the amount therein deposited derived from the sale to the state, as the banks might qualify to receive, not exceeding $100,000 in any one of them, and to designate to the county court other convenient banks or trust companies located within the state in which he desired to deposit the residue of such funds; and the county court to convene and pass upon his designation of additional depositories, pursuant to the requirements of chapter 84 and as therein provided; and that together they do and perform any and all things necessary or required to place such proceeds upon interest as aforesaid and to carry out the provisions of the act, or that they do appear at the time and place *767designated therein and show canse, if any they can, for refusing to obey that command.
The matters arising upon the petition, the alternative writ, the responses therto, other pleadings and proof, relate to the control and disposition of the funds derived from the sale to Powell, Garard & Company until such time as such proceeds actually are needed to accomplish the purposes for which the indebtedness was created.
The first and only important proposition urged by counsel for the respondent county court is that the sheriff can not be compelled by mandamus to deposit the funds as prayed, because he has not had and does not now have the requisite possession and control thereof to enable or permit him to comply. Concretely stated, the proposition is that, as the county court assumed the temporary control of such proceeds, and, in the exercise of such authority, placed the funds beyond the reach of the sheriff, compliance with any mandate requiring a different disposition is not within his power. The basis of this authority or control, if it has any basis in law or fact, exists in virtue of the concluding provision of §56a25a, ch. 43, Code. It says: ‘ ‘ The president of the county court shall have power, when so directed by such court by an order entered of record therein, to execute, sell and deliver the bonds of said county and to receive the proceeds therefrom. ’ ’
The sole force and effect reasonably to be attributed to this provision, and all that it contemplates, when considered in conjunction with other statutes defining the powers and duties of the sheriff, is to constitute the president of the county court the intermediary between the purchasers of the bonds and the sheriff, the legal custodian of the funds belonging to his county. Of all the funds of the county in the hands or control of the sheriff the county court of course has the exclusive right of appropriation; but at no time does It have any other control of the funds. The provision cited does not empower that court to exercise any authority over the disposal or custody of the proceeds until needed for highway improvement. The right assumed, and contended for in argument, can not be admitted or conceded. Other statutes dealing with the subject expressly designate the sheriff as *768the treasurer and legal custodian .of all moneys belonging to-any county or its subdivisions. §1, ch. 30; §32, ch. 39; §48, ch. 137, Code. These statutes express the will of the legislative branch of the state government, wherein is reposed supreme control of the method and manner of the management of public funds of every description. The county court-is not, nor is any member thereof, strictly speaking, the fiscal agent of the counties they represent. The proceeds of the bond sales are “public moneys” within the meaning of §58, ch. 39, Barnes’ Code, which defines the term as embracing “all money which by law the sheriff in his capacity as-such and as treasurer of the county and district is authorized to collect, receive and disburse for public purposes”, including those annually levied, collected and disbursed as and when necessary for the payment of the orders drawn thereon by the proper authority. While it may be true the sheriff' does not, strictly speaking, collect the proceeds of a bond issue authorized by law for the improvement of county roads, as in the ease of annual tax levies for current fiscal expenses, in legal contemplation he is the disbursing officer of his; county, and pays orders drawn upon him by the county court. As necessarily in his capacity as such officer he must have-unrestricted access to the moneys appropriated to certain specific purposes, his control must remain unobstructed by any act or power the effect of which would place the proceeds-of the bonds in a custody not legally authorized to receive them. This authority and right the county court virtually admits by its orders entered of record and the act of its-president permitting, directing or acquiescing in the sheriff’s', receipt- of the $250,000 paid by the state, as well as the-$300,000 derived from the sale to Powell, Garard & Company. Of these the president of the county court did not, nor did. the court- itself, become the recipient. Short received them and he alone. No statute, not even the. provision relied on by the respondent county court, was intended to empower a county court to receive or retain such proceeds in its possession or under its dominion. If the court or its president assumed any authority or attempted to exercise any control over the transfer of the proceeds of the bond issue, they did *769so only as the medium between the purchasers and the sheriff as the recognized legal custodian, to whom ‘1 all money collected or received for the use of the county or districts shall be paid”, “to be kept and disbursed by him for county or-district purposes under the regulations prescribed by law”. §32, ch. 39, Code.
The record sufficiently shoAvs that the money paid by Powell, Garard & Company for the bonds purchased by them was paid either directly to the sheriff by them, or to the president of the county court and by him to the sheriff, who retained possession of the same until he was deprived of it by ' his co-respondent in the manner adverted to in another connection. In his return to the alternative writ, the sheriff-says: “On or about the 15th day of February, 1916, said bonds were delivered to Powell, Garard & Company, Avho paid into the hands of this respondent, as sheriff of said county, the said sum of $300,000 and the accrued interest thereon, amounting to $3333.33”. This statement the county court urges us to assume resulted from a misconception or inadvertence on his part. However, he does not seek to impugn his own answer; he has not craved the privilege to amend it., Apparently he adheres to the statements therein made.
The funds derived from the sale to the purchasers, although placed in bank pursuant to the order of the county court, Avere deposited to the credit of the respondent Short in his official capacity in the several banks selected by the court as depositories thereof. Certificates of such deposits were made by the banks payable to him as sheriff. And, notAvithstand-ing the intrusive order of the county court; such disposition of the funds still leave them in his custody, agreeably to the provisions of the statutes naming him as treasurer of the county, subject always to the payment of orders properly draAvn thereon. It can not, then, be -said the funds have never been placed in that custody Avherein the law reposed them.
The respondent Short, pursuant to the requirements of chapter 84, acts 1915, in July and August, 1916, prior to the institution of this proceeding, designated and the county court approved as county depositories the Citizens National *770Bank of Pineville, the First National Bank of Pineville, the Bank of Mullens and the Bank of Wyoming, all of them within the county of Wyoming; in which he desired to deposit the public funds of the county; which banks, within twenty days thereafter, complied with the requirements of the act by executing and delivering the requisite indemnity, conditioned as provided therein. These bonds the county court accepted as satisfactory. Therein the sheriff deposited, in different amounts, the proceeds of the bonds purchased by the state, at three per cent interest on daily balances. As to these funds he acted clearly within the authority of chapter 84 and in conformity with its provisions. From his answer to the alternative writ, we are justified in assuming that, but for the interference and restraint imposed by the order of the county court, he would have made a similar disposition of the funds derived from the sale to Powell, Garard & Company. To this restraint and interference he vigorously objected and protested, though in vain, as we 'may judge from his response to the writ.
While it is conceded in argument that the county court may by mandamus be compelled to comply with the requirements of chapter 84, upon the petition of any citizen or taxpayer or any officer charged with the duty of enforcing compliance with the statutes relating to the collection and disbursement of public moneys, it nevertheless is contended that the writ does not lie in this instance for another reason. It is said this is a proceeding to review the action of the court in directing the deposit of the proceeds of the bonds sold to Powell, Garard & Company in the banks agreed on between it and them. If it were true, as suggested, that the proceedings were of that nature, mandamus will not of course lie. It is not a writ of review. Nor is it necessary to declare anew that mandamus is not an available remedy where the right or duty the enforcement or performance of which is sought is of doubtful character or impossible of performance, ■ or obedience to the mandate is vain and fruitless; nor where a doubt may exist as to the necessity or propriety of the action required; nor to compel the undoing of an act already accomplished; nor where there exists another adequate rem*771edy; nor to supervise the exercise of a discretionary power. As to these conditions the only observation required is that they are not within the purposes contemplated by the rela-tors, or the court in awarding the writ.
It must be assumed that the legislature, in enacting chapter 84, acts 1915, deemed it unnecessary to authorize the writ of mandamus to compel a mere ministerial officer to perform the functions required by that act. It doubtless was passed with full knowledge of the general availability of that writ to compel the sheriff and treasurer to perform such duties as the statute imposed on him. Such use was made of the writ in State v. Cronin, 72 Neb. 636. The statute of that state required each county treasurer to keep at all times on deposit in each of the depository banks of his county definitely defined proportions of the public funds under his control. Likewise, it was held in State v. Spinney, 166 Ind. 282, that mandamus lies to compel a county treasurer who has collected taxes on behalf of a city to pay the same to the municipal treasurer. As held in People v. Gibler, 78 Ill. App. 193, the writ lies to compel a city treasurer to deposit moneys belonging to the city in the depositories selected by the council by its ordinances. Also in Board v Clark, 117 Ga. 288, the writ was held applicable to compel county commissioners to pay to the county treasurer a road fund which came into their hands for road improvement purposes under the statute. See also Tyler v. Taylor, 29 Grat. 765; Robinson v. Rogers, 24 Grat. 319.
But it is contended, further, that the writ is inadequate to reach the proceeds of the sale to Powell, Garard & Company, as the money is deposited in certain banking institutions pursuant to an agreement between them and the county court made before July 1, 1916, the date at which chapter 84, acts 1915, became effective. It is to be observed, first, that undoubtedly the county court knew, as perhaps also did the banks it selected, that the legislature had enacted that chapter prior to the time the agreements were entered into. Such knowldge on its part can not be 'gainsaid. In obedience to the legislative mandate, the sheriff designated certain banking institutions within the county as depositories of the *772funds in his hands or control. Those so named did not include some of the banks previously named by his co-respondent. These selections the county court approved, as it did also the bonds entered into by the depositories as required by the statute. Moreover, the funds derived from the sale to the state the sheriff, with the knowledge of the county court, deposited in the banks selected by him, upon the terms and conditions required by the act.
While conceding, but not deciding, that the county court may have entered into agreements, valid and binding when made, with the depositories designated by it regarding the deposit of the $300,000, did it then have the right and authority, in direct contravention of the plain intendment of the statute, to make an irrevocable agreement for disposal of such funds after the act became effective? That evidently it.could not do, whatever may have been the motive prompting it. To permit such dealings Avith the public funds of the county virtually would operate to repeal or superséde an enactment the real purpose of which was to protect the moneys of the county from the danger of spoliation. These contracts were •ultra vires and void, both as to the county court and the banking institutions, in so far as they purport to place the funds beyond the control of the county court or the'sheriff after July 1, 1916. Thereafter they ceased to be operative for any purpose. They do not now bind the county court or the sheriff, and do not avail as a protection to the banks in which the proceeds were deposited. The act virtually constitutes a prohibition against deposits not made in conformity therewith.
Practically unanimous are the authorities in holding that no contract can be enforced which, although originally made consistently with the then rules of law, is rendered unlawful by the subsequent enactment off a statute before the expiration of the time for performance. In such circumstances, the supervening impossibility of performance, caused by the operation of a change in the law, renders nugatory and ineffectual any agreement inconsistent therewith after the change takes .effect. 3 Elliott on Contracts §1901; Macon Railroad Co. v. Gibson, 85 Ga. 1; Jamieson v. Gas & Oil Co., 128 Ind. *773555. “It is a general principle of law that when a contract is lawful when made, and a law afterwards renders performance of it unlawful, neither party to the contract shall be prejudiced, but the agreement is to be regarded as at an end”. 2 Elliott on Contracts 40. Dorr v. Railway Co., 88 S. E. 666, applies the same principle. 9 Cyc. 629 treats of the avoidance of such contracts as the result of an impossibility created by law”, and reaches the same conclusion. So it may be repeated that after July 1, 1916, the contracts between the county court and the several banking institutions selected by it ceased to have any binding force or effect upon either of the parties thereto. It is not within the power of the county court or of the sheriff to enter into any contract the enforcement of which by the parties thereto would effectually place the funds of a county beyond the ready reach of the custodian upon whom the law imposes the duty of depositing the funds in the manner thereby required. In entering into these engagements, to which the county court attaches such forcefulness and efficacy for the conservation of the road improvement fund, it professes to have acted in the interest and for the welfare of the county. It may have done so. There is no proof in the record of any sinister purpose on its part; and it may reasonably be assumed, then, that it acted in good faith in the premises, although in violation of the statute. .Nothing said in this discussion is intended to impugn the motives of any one connected with the transaction. What they did must be dealt with upon legal principles. With their acts we are concerned, not with the motives prompting them.
Powell, Garard & Company proposed, in writing duly signed and delivered, to the county court, to purchase at par the bonds sold to them, and thereby agreed to pay, and, in compliance with the contract regularly approved by the proper authority, did pay, $300,000 therefor and the interest accrued at five per cent to the date of the purchase. Although this offer contained no conditions, restrictions or reservations, it is claimed that, as an inducement • for the consummation of the sale, the condition was superadded, not as a matter of record but as a “gentleman’s agreement”, *774that the purchasers should be entitled to the interest on the purchase price until the money was required for the improvements. Conformably with these undertakings, the deposits were made in the several banks, for which they severally issued certificates, in different amounts, payable on different dates to the order of the sheriff on the return of the certificates properly endorsed, but without interest. These undertakings so made required the sheriff, in contravention of the statute, to deposit public moneys without interest except for the profit of beneficiaries other than the taxpayers of Wyoming county.
In defense of these arrangements it is argued, first, that without the concession made the county court could not have effected the sale to Powell, Garard & Company, or to any other purchaser at a rate of interest less than six per cent; and, second, that they enured to the benefit of the taxpayers. Whether such benefit would have resulted it is not necessary to say. However that may be, it is clear that Powell, Garard & Company did not require, as a condition of their purchase, in the written proposal, payment to them of the interest on the money until and as it was needed for the purposes of the original appropriation. Their proposition was without a.ny condition whatever. Besides, they paid the interest that had accrued on the bonds from the issuance thereof to the date of the purchase. It ■ appears, however, from the affidavits of their representatives, that the banks have paid to Powell, Garard & Company interest on the deposits held therein — it is alleged, in compliance with the condition so imposed.
This disposition of the funds the county court contends is not remediable by mandamus: That, if remediable at all, there exists another clear and adequate remedy by an action on the sheriff’s bond. It is argued that, if the respondent Short, as sheriff and treasurer, having possession and control of the funds, failed or refused to deposit them as required by the depository act, he and his sureties could be made to respond for the consequences of the default in an action at law. For this position Supervisors v. Powell, 95 Va. 635, only is cited as authority. There the relators undertook to compel a county treasurer to collect taxes from a municipality, which *775refused payment on the ground of an exemption from tax levies. The court denied the writ, as an action on the bond' of the delinquent official was held to be an available and adequate remedy. That decision coneededly is sound, but it is; without apparent application to the facts herein involved. :
To defeat relief by mandamus, the substitute suggested' must be competent to meet the object intended and compel performance of the required duty; it must be adequate to afford the same degree of relief, upon the same subject matter,' and prove equally beneficial and efficacious as the writ itself. Railway & Electric Co. v. Brown, 97 Va. 26; Sinclair v. Young, 100 Va. 284; Railway Co. v. Board of Supervisors, 109 Va. 44. These objects, evidently, an action on the slier--' iff’s bond would not accomplish. It would hot, indeed could' not, enable the sheriff to repossess the specific fund or its" equivalent, so as to replace it in the same or other banks as’ required by the statute. Not only would the remedy suggested prove inadequate — it would clearly be wholly abortive. State v. Dougherty, 45 Mo. 294; State v. Staley, 38 Ohio 264; Babcock v. Goodrich, 47 Cal. 488; Prescott v. Gonser, 34 Ia. 175; see also People v. Brennan, 39 Barb. 536. Besides, its resultant effect would be to impose upon those against whom no real cause of complaint exists the responsibility of a diversion chargeable to the action of the respondent that now denies the efficacy of the present proceeding. Mandamus clearly is the proper, indeed the only prompt, efficient and competent process to secure compliance with the legislative provision requiring the deposit on interest of county funds.
Finally, it is contended that the command of the alternative writ is not sufficiently comprehensive to secure the relief asked for by the petitioners. In response to that argument, it is sufficient to say that, if the impediment pointed out exists, it can be removed by an enlargement of the scope of the peremptory writ when awarded. State v. Railway Co., 65 W. Va. 115. That writ, therefore, will command the respondent Short, as sheriff, forthwith to deposit the $300,000 derived from the sale to Powell,. Garard & Company, at three per cent interest on daily balances, in the Citizens National Bank of Pineville, the First National Bank of Pine-*776ville, the Bank of Mullens and the Bank of Wyoming, or so much thereof, in excess of the amount heretofore deposited therein derived.from the sale to the state, as such hanks may qualify to receive, not exceeding $100,000 in any one of them and to designate to the county court other convenient banks or trust companies located within the state in which he desires to deposit the residue of such funds, and to institute and prosecute such actions or proceedings as may be necessary to reduce such funds into his possession in order to comply with the mandate.of the writ; and the county court to convene and act in conjunction with the sheriff and pass upon his designation of additional banks and trust companies as depositories pursuant to the requirements of chapter 84; and that both respondents do and perform such other acts as may be necessary to conform in all respects with the requirements of that statute.
Peremptory ivrit awarded.