
194 Cal.App.2d 107 (1961)
DAVE SHOCKLEY, Appellant,
v.
GENERAL CASUALTY COMPANY OF AMERICA (a Corporation), Respondent.
Civ. No. 10143. 
California Court of Appeals. Third Dist.  
July 21, 1961.
 Mathews and Traverse for Appellant.
 Hahn and Hahn and Loren H. Russell for Respondent.
 WARNE, J. pro tem.  [fn. *]
 In 1956, Carlotta Lumber Company commenced an action against the appellant herein and caused a writ of attachment to be issued and levied upon a pickup truck, compressor and other equipment owned by appellant, Shockley. Prior to the issuance of such writ, Carlotta Lumber Company filed an undertaking on attachment whereby the respondent, General Casualty Company of America, as surety, promised that if Shockley recovered a judgment it would pay all costs and damages that might be sustained by him in the attachment suit, not to exceed $2,500. The value of the use of the property levied upon and seized by the sheriff for the time it was held was in excess of $2,500. On September 27, 1957, Carlotta Lumber Company voluntarily filed a request for dismissal of the attachment action and Shockley then demanded of Carlotta Lumber Company payment of his damages for the loss of the value of the use of the property seized and held by the sheriff by virtue of the attachment. Payment was refused.
 In November of 1958, appellant, Shockley, commenced the present action against respondent to recover his damages on the surety bond issued in the attachment action. The trial court concluded that the respondent was not obligated on its surety bond and entered judgment in favor of the respondent.
 The findings of fact are in accordance with the above factual statement. Shockley appealed from the judgment.
 [1] The issue presented on this appeal is whether the voluntary dismissal by Carlotta Lumber Company of its attachment action operated as a judgment in favor of the defendant within the meaning of section 539 of the Code of Civil Procedure, which so far as here pertinent provides:
 "Before issuing the writ, the clerk or judge must require a written undertaking on the part of the plaintiff with two or more sufficient sureties, to the effect that if the defendant recovers judgment, the plaintiff will pay all costs that may be awarded to the defendant and all damages which he may sustain by reason on the attachment, not exceeding the sum specified in the undertaking. ..."
 We believe that the court erred in holding that respondent was not liable on its surety bond. We believe that the words *109 "if the defendant recovers judgment" cannot be given so limited a construction. On the contrary, we think the broad definition given in section 577 of the Code of Civil Procedure should be here applied. That section defines a judgment as follows: "A judgment is the final determination of the rights of the parties in an action or proceeding."
 We believe that when plaintiff voluntarily filed a dismissal of the attachment action it was in effect the recovery of judgment by defendant so far as the attachment for which the bond was given is concerned. [2] The purpose of requiring a bond is to protect the defendant against damage by reason of the attachment, and when the attachment was terminated by the dismissal of the action, the defendant was entitled to the recovery of any damages suffered by reason of the attachment. To hold otherwise would, in our opinion, do violence to what was undoubtedly the intent of the Legislature in requiring the bond and would defeat the purpose of the statute.
 The judgment is reversed.
 Peek, Acting P. J., and Schottky, J., concurred.
NOTES
[fn. *]  *. Assigned by Chairman of Judicial Council.
