Haiaam, J.
The Enterprise Manufacturing Company sued plaintiffs in this action and attached Certain of their property. To procure the attachment the *202Enterprise Company gave a bond with itself as principal, and defendant American Surety Company as surety, conditioned to pay all damages sustained “in case the defendants recover judgment or in case the writ shall be set aside or vacated.” No move was made to set aside or vacate the attachment. After some lajose .of time the parties to the attachment suit settled their differences and stipulated as follows: “All matters in dispute between the respective parties * * * having this day been settled and adjusted, it is hereby stipulated and agreed that the said action be * * * dismissed * * * that all property taken and held by the sheriff * * * under * * * writ of attachment in said action, shall be by said sheriff returned to said defendants.” This stipulation was filed with the clerk of the district court. Ten months later judgment of dismissal was entered in favor of Downs & Sons, the defendants in that action. The judgment recited that it was entered pursuant to the stipulation of the parties. The property was restored to Downs & Sons. They now contend that the property was damaged while under attachment, and they bring this action against this defendant as surety on the bond. Liability is claimed, not on the ground that the writ of attachment was “set aside or vacated,” but on the ground that defendant in the attachment suit “recovered judgment.” The court instructed the jury that defendant surety company was liable for all damages Downs & Sons sustained by reason of the attachment. The jury returned a verdict for plaintiffs accordingly. Defendant appeals.
We are - of the opinion that defendant was entitled to judgment as a matter of law.
First. The stipulation above mentioned settling all matters in dispute between the parties operated to release the Enterprise Company from all liability on the attachment bond. That company was the principal on the bond, and defendant was surety. It is well settled that the release of a principal operates as a discharge of the surety. Ames v. Wilkinson, 47 Minn. 148, 49 N. W. 696; Finnegan v. Janeway, 85 Minn. 384, 89 N. W. 4; Bull v. Rich, 92 Minn. 475, 100 N. W. 212, 101 N. W. 489; 1 Brandt, Suretyship (3rd ed.) § 164.
Second. This is a statutory bond, and the statute forms part of the contract of the parties. The requirement of the statute is that the bond shall be so conditioned as to be operative “if judgment be given for the *203defendant.” G. S. 1913, § 7847. Perhaps this means the same as the language of the bond, “in case the defendants recover judgment.” In any event the obligation of the surety under the bond must be construed as being coincident with the obligations imposed by the statute, unless such a construction does violence to the language of the bond. Combs v. Jackson, 69 Minn. 336, 72 N. W. 565; Fairmont Cement Stone Mnfg. Co. v. Davison, 122 Minn. 504, 509, 142 N. W. 899, Ann. Cas. 1914D, 945; Fay v. Bankers Surety Co. 125 Minn. 211, 214, 146 N. W. 359, Ann. Cas. 1915C, 686. We think it does not in this case, and for purposes of construction we take the language of the statute as being a somewhat clearer expression of the same intent as the language of the bond. The judgment obtained pursuant to stipulation of the parties and by settlement of the case was not a “judgment * * * given for the defendant” as contemplated by the bond or the statute. The purpose of the requirement 'of the statute for an attachment bond is to protect the defendant against wrongful attachment. Liability is accordingly made to arise if the attachment is set aside or vacated, or if judgment is given for the defendant, because if the plaintiff have no cause of action so that judgment is given against him, or if, having a cause of action, he has no statutory ground for attachment, the attachment must necessarily be wrongful. “Judgment * * * given” for the defendant means that a judgment is given by the court determining that the defendant had no cause of action when the attachment was procured.. It may be a judgment after trial on the merits, or it may be a judgment of dismissal. Nielsen v. City of Albert Lea, 87 Minn. 285, 91 N. W. 1113; St. Joseph & Elkhart Power Co. v. Graham, 165 Ind. 16, 74 N. E. 498, 6 Ann. Cas. 399. Both have the same significance in this particular. The reasons for such a rule are manifest. A cause of action on the bond cannot be created by act of the defendant in the attachment suit after the attachment has been made. For example, it would be unthinkable that in a case where suit is brought on a just debt, and attachment is procured based on just grounds, the defendant could, after suit brought, by payment of the claim and procurement of a judgment of dismissal in that manner, create a liability on the bond. Nor can he accomplish that result by a settlement and payment of the claim *204through negotiations and agreement with the plaintiff in the attachment suit.
Authorities upon this proposition are very meager, but the case is governed by substantially the same principles as apply to injunction bonds (Frost v. Jordan, 37 Minn. 544, 545, 36 N. W. 713); and in the case of injunction bonds there are numerous pertinent decisions. The courts are quite unanimous in holding that, where an injunction is procured pendente Hie and an indemnity bond given, judgment entered upon stipulation of the parties, pursuant to an amicable settlement of the case, does not give rise to liability on the bond. Large v. Steer, 121 Pa. St. 30, 15 Atl. 490; Palmer v. Foley, 71 N. Y. 106; Columbus, H. V. & T. Ry. Co. v. Burke, 54 Oh. St. 98, 43 N. E. 282; St. Joseph & Elkhart Power Co. v. Graham, 165 Ind. 16, 74 N. E. 498, 6 Ann. Cas. 399. The reasons there are the same as here. Were the rule otherwise, the liability of the surety could be fixed by the agreement of the parties without the surety’s assent, and even without his knowledge, instead of by determination of the court as contemplated by the bond. Large v. Steer, 121 Pa. St. 30, 34, 15 Atl. 490.
It is contended that this is a collateral attack upon the judgment in the attachment suit. We do not consider it an attack upon that judgment at all. The face of the judgment may, we think, be examined to determine the nature of the judgment without infraction of the rule against collateral attack. Boom v. St. Paul F. & M. Co. 33 Minn. 253, 22 N. W. 538.
Order reversed and judgment ordered for defendant.
On March 1, 1916, the following opinion was filed: