MR. JUSTICE WHITE, after stating the facts, delivered the opinion of the court.
Much was said in argument at bar upon the question of when a contract is to be regarded as completed under the circumstances here presented, and the discussion concerning the authority of the Secretary of War to review the action of an officer of engineers in such a case, and to direct a new adjudication, has taken a wide range. We deem the consideration of both these points unnecessary in view of the relator's bids under the second advertisement and specifications, and his contract to do the work at a less price and under new conditions. It is elementary law that mandamus will only lie to enforce a ministerial duty, as contra-distinguished from a duty which is merely discretionary. This doctrine was clearly and fully set forth by Chief Justice Marshall in Marbury v. Madison, 1 Cranch, 137, and has since been many times reasserted by this court. See Kendall v. Stokes, 3 How. 87; Brashear v. Mason, 6 How. 92; Reeside v. Walker, 11 How. 272; Commissioner of Patents v. Whiteley, 4 Wall. 522; United States v. Seaman, 17 How. 225, 231; United States v. Guthrie, 17 How. 284; United States v. The Commissioner, 5 Wall. 563; Gaines v. Thompson, 7 Wall. 347; The Secretary v. McGarrahan, 9 Wall. 298; United States v. Schurz, 102 U.S. 378; Butterworth v. Iloe, 112 U.S. 50; United States v. Black, 128 U.S. 40; Commissioners of Taxing Dist. of Brownsville v. Loague, 129 U.S. 493; Noble v. Union River Logging Railroad, 147 U.S. 165.
The duty to be enforced by mandamus must not only be merely ministerial, but it must be a duty which exists at the time when the application for the mandamus is made. Thus in the case of Ex parte Rowland, 104 U.S. 604, 612, this court, speaking through Mr. Chief Justice Waite, said: "It is settled that more cannot be required of a public officer by mandamus than the law has made it his duty to do. The object of the writ is to enforce the performance of an existing duty, not to create a new one."
Moreover, the obligation must be both peremptory, and plainly defined. The law must not only authorize the act, Commonwealth v. Boutwell, 13 Wall. 526, but it must require the act to be done. "A mandamus will not lie against the Secretary of the Treasury unless the laws require him to do what he is asked in the petition to be made to do," Reeside v. Walker, 11 How. 272; see also Secretary v. McGarrahan, 9 Wall. 298; and the duty must be "clear and indisputable." Knox County Commissioners v. Aspinwall, 24 How. 376. Now, at the time that this application was made for a mandamus against Secretary Lamont, the relator had entered into a contract to do the work in question at a lower price than that mentioned in the first advertisement and bid, and on different terms. This contract had been entered into by him voluntarily. We cannot perceive any duty which under these circumstances rested upon the Secretary of War to sign such a contract with the relator as would be required by the mandamus which is prayed. It cannot be reasonably contended that he is under any obligation to sign two contracts with the same person for the same work at a different price and under different conditions. Nor can it be urged with any greater reason that the relator was entitled to have signed a contract to do work for 19.7 cents per cubic yard, which he had subsequently made a voluntary contract to do for 13.7 cents per cubic yard, and upon conditions different from those mentioned in his first proposal. In order to justify the issue of the writ, then, it would be necessary for us to hold that the second contract was void, and thereby to relieve the relator from obligations which he has assumed, and release him from the binding force of terms and stipulations to which he has subjected himself. Inasmuch as no such duty as that which the granting of this writ would seek to enforce exists, and no right subsists in the relator which this writ could secure him, there is no ground for issuing it. The writ of mandamus cannot be used to set aside a contract which has been voluntarily entered into. Detroit Free Press Co. v. Board of Auditors, 47 Michigan, 135.
But even if the writ of mandamus could be so perverted as to make it serve the purposes of an ordinary suit, the relator is in no position to avail himself of such relief. He entered of his own accord into the second contract and has acted under it and has taken advantages which resulted from his action under it, having received the compensation which was to be paid under its terms. Having done all this, he is estopped from denying the validity of the contract. Oregonian Railway v. Oregon Railway, 10 Sawyer, 464. Nor does the fact that in making his second contract, the relator protested that he had rights under the first better his position. If he had any such rights and desired to maintain them, he should have abstained from putting himself in a position where he voluntarily took advantage of the second opportunity to secure the work. A party cannot avoid the legal consequences of his acts by protesting at the time he does them that he does not intend to subject himself to such consequences. In the case of The Bank of the United States v. The Bank of Washington, 6 Pet. 8, certain payments had been made to the first bank upon a decision by the court below, with notice that the payer intended to take the case to the Supreme Court of the United States, and would expect the payee, the Bank of the United States, to refund the money if that court should reverse the decision of the court below, and hold that it was not due. The court said: "No notice whatever could change the rights of the parties so as to make the Bank of the United States responsible to refund the money."
The whole case of this relator is covered by Gilbert v. United States, 8 Wall. 358, in which this court, through Mr. Justice Miller, said: "If the claimants had any objection to the provisions of the contract they signed, they should have refused to make it. Having made it and executed it, their mouths are closed against any denial that it superseded all previous arrangements." The claim that the purpose of the mandamus which is here asked is not to determine the existence of a contract, or of rights arising thereunder, but only to require the furnishing of evidence, simply changes the form of the contention without affecting its real merits. If, as we have shown, there is no duty resting upon the Secretary to enter into the contract here claimed, necessarily there can be no duty on his part to put into the hands of the relator evidence of the contract having been entered into.