The right of a plaintiff to discontinue his suit at his pleasure and of course, as a general proposition is undoubted, but the proposition is not unqualifiedly true. It is a right to be exercised at all times by the leave and with the consent of the court. The courts have uniformly held for instance, that a plaintiff cannot be-allowed to .discontinue his action without the payment of costs to the defendant, except in certain cases where it has-exercised the power to excuse him from the payment of such costs, which it has done in many cases. Where a defense-of infancy is set up the court has allowed the suit to discontinue without the payment of costs and without doubt of its power to do so. (Van Buren agt. Foot, 4 Wend. 209.) So when a defendant becomes insolvent and obtains a discharge-(Collins agt. Evans, 6 John. 333; Lindley agt. Hackett, 18 Icb. 252), or when a defendant has been declared a bankrupt [Park agt. Moore, 4 Hill, 592; Smith agt. Skinner, 1 How. 122; also in case of change of practice (Sunney agt. Roach, 4 Abb. 16); or where a defendant has been joined as a party by mistake (1 Hill, 560, &c.; 9 Abb. 175).
*242In these and numerous other cases the courts have claimed and exercised the power to restrict and control the right to discontinue and to determine the grounds upon which it should be allowed. Unless the plaintiff has been excused upon some ground from the payment of costs in such cases, it has uniformly been held, that the cause was not and could not be discontinued till the defendant’s costs were actually paid. A liability to pay them is not sufficient or an order or stipulation to pay them; they must be actually paid before the case is considered out of court (1 Wend. 13; 9 id. 511; 2 Hill, 384); and until such costs are actually paid or tendered the defendant may proceed in the case (7 Hill, 195).
The principle asserted in all these cases and in numerous others is, that the right to discontinue is not absolute, that it is to be exercised under the control of the court, and that equitable terms may be imposed in proper cases; and that the right to discontinue may be disallowed in the discretion of the court, or restricted * * * upon equitable considerations.
In Van Allen agt. Schermerhorn (14 How. 287), Judge Harris refused to allow a suit to be discontinued where the defendant had set up a counter-claim, against which the statute of limitations would be a bar if the suit was discontinued.
Judge Harris said it would be obviously unjust to allow the plaintiff to discontinue in such a case.
The same view was taken in a similar case in Cockle agt. Underwood (3 Duer, 676), by Judge Bosworth of the superior court, which was affirmed at a general term ©f that court by the concurrence of all the judges. In that case, it appears, it is true that the plaintiff had failed to reply to the counterclaim, and this consideration Judge Mitchell, in the case of the Seaboard and Roan Oak R. R. Co. agt. Ward (18 Barb. 589), thought a material reason for assenting to the correctness of the decision in that case. But the power of the court to deny the discontinuance cannot, I think, be made to *243depend upon any such consideration. It is, however, a very proper and strong reason addressed to the discretion of the court, why it should refuse the discontinuancej but it obviously is not the only reason that should be listened to and regarded by the court upon the question. In affirming the decision in the case of Coclde agt. Underwood, Judge Oakley said “ it would be manifestly unjust in such cases (the defendants in that case having been examined as witnesses by the plaintiff), to permit an action to be discontinued even when Sufficient cause was shown for it, without requiring the plaintiff to stipulate that the defendant might read the examination in evidence upon the trial of any new action that might be brought.” This is the precise condition imposed at the special term in this case, and I presume it was in pursuance of this suggestion of Judge Oakley’s, that the provision objected to in the order appealed from was made.
Judge Oakley had obviously contemplated a case quite like the one presented upon this appeal, for he said further, “unless such stipulation was required, a plaintiff might examine a defendant under the Code, and if the testimony disproved the cause of action, he could at once discontinue it and bring a new action if a discontinuance was allowed, as a matter of course, if for no other reason than to deprive a defendant of the benefit of the testimony he had compelled him to give.” The case of Cook agt. Beach (28 How. 358), is a case quite like the present, except that the testimony of the deceased witness had not been completed before his death, and the rights of the parties in respect to it rested upon a stipulation.
Judge Hogeboom asserted the general rule, that a plaintiff has the right to discontinue his action as a matter of course, on payment of costs, but he admits that “ there may be circumstances controlling this right ”—and refers to the cases of Van Allen agt. Schermerhorn, and Seaboard, and Roan Oak R. R. Co. agt. Ward (supra), as illustrating the exeception to this general rule, and without dissent from the views *244there expressed. The learned judge substantially admits that the “right to the order is not absolute, but must depend upon equitable considerations “ addressed to the discretion of the court, and for this reason I should presume the general term in that case did not think it proper to reverse the decision of the special term.
But I am not quite satisfied with the decision in that case made at special term, and think the court should have imposed as a condition of the discontinuance the precise condition in substance suggested by Judge Oakley in Cockle agt. Underwood, and imposed by the learned judge at special term in this case. To allow a party to discontinue in such a case after the testimony to prove a defense has been made, and, the witness since deceased—is as substantial an injury to a defendant as it would be to allow an action to be discontinued, after the statute of limitations had attached to a counter-claim, and the plaintiff had failed in time to reply to it— as the plaintiff in such case might be relieved on motion. It is in effect to deprive a defendant probably of all defense to the action. It is the taking of an unjust and unconscientious advantage of the party, which should not be allowed when the court has the power to prevent it.
The plaintiff should not be required to prosecute a suit if he wishes to put an end to it, and to the litigation entirely; but where he has long litigated a question and put the defendant to much expense and trouble, and is substantially defeated in it—if he wishes to discontinue it should be upon terms that he will not commence a new suit, or transfer the right of action, and that the defendant’s testimony properly taken in it, may be used in any new action. This is but just and fair, and I think the court has the power in its discretion, to impose such terms upon a plaintiff seeking to discontinue his action; and that a decision thus made at special term should not be reversed.
The order should, therefore, be affirmed with $10 costs.