Hatch, J.:
The moving papers tend to establish that the relator has performed his contract to an extent which entitled him to the payment as claimed. In support thereof he produces the certificate of the engineer in chief of the department of docks and ferries that there has been earned under the contract a sum sufficient to entitle him to the payment represented by the warrant which the order directs to be drawn. It is evident, therefore, that under former decisions of this court, which are supported by the decisions of the Court of Appeals,
*132the relator makes prima facie case upon which to base the order. The opposing papers tend, however, to establish that the relator has not performed his contract according to the plans and specifications which form a part of it, in that rotten and unsound timber have been used instead of new and sound timber, and that the cribs upon which the surface of the pier is to be constructed are canted instead of being placed straight. The- contract under which the work is to be performed provides that the certificate of the engineer is conclusive only ujion the contractorit does not conclusively bind the city nor any of its officers; as to it and them it remains open to be avoided by any facts which properly tend to impeach it. If it be established as a fact that the work and materials used do not conform to that for which the plans and specifications call, the certificate of the engineer will not prevail. We are not now required to examine or pass upon the question as to how far or upon what subjécts proof in avoidance of the certificate may be given, except to determine whether the city is estopped by the certificate from showing that the performance of the contract is not in compliance with the plans and specifications. It is evident that so far as this subject is concerned the city is not estopped by anything which the contract contains; on the contrary, such subject remains open, so far as the city and its officers are concerned, as the same is not made binding upon it or them. This court has decided, where it appears that there exists no dispute as to the performance of the contract, that the sum secured to be paid thereby is admittedly due, and that all that remains to be done is the drawing and delivery of the warrant of the comptroller ; that such officer stands in the relation of performing a mere ministerial act, which the court will compel to be done by a writ of mandamus. (People ex rel. Rodgers v. Coler, 56 App. Div. 98 ; People ex rel. Treat v. Coler, Id. 459.)
These cases, however, are not authority for the issuance of a, mandamus in every case, even though the contractor makes out a prima facie case entitling him thereto. The party moving for the writ must establish a clear legal right thereto, and where he has a remedy to enforce payment by action he will ordinarily be remitted to that remedy. The application for the writ is addressed to the sound discretion of the court, and if it can see that there exists, or may exist, a fair ground of contest over the performance of the contract, or *133the amount due thereunder, the writ will be refused and the party will be remitted to his action to establish his claim. (Matter of Freely 148 N. Y. 165 ; People ex rel. Beck v. Coler, 34 App. Div. 167.)
It is quite clear that upon the proof submitted by the opposing papers herein the city may have a perfectly good defense to the present claim upon the merits. This consideration furnishes abundant reason why the writ should not be granted and why the relator should be remitted to his remedy by action to enforce the claim. It follows, therefore, that the order should be reversed, with ten dollars costs and disbursements, and the motion for the writ denied, with ten dollars costs.
Ingraham and McLaughlin, JJ., concurred; Van Brunt, P. J., and O’Brien, J., concurred in result.
Order reversed, with ten dollars costs and disbursements, and motion denied, with ten dollars costs.