When any attachment is sued out, either at law or in equity, except against a nonresident, on such an affidavit as is mentioned in the first section of this article, and the property is seized and retained by the officer, the interest and profits thereof, pending the suit and before judgment or decree, may be paid to the defendant, if the court deem it proper; and at any time during such period the court, or in vacation the judge thereof, may discharge the attachment, as to the whole of the estate of the defendant, on his giving bond, with security, payable to the plaintiff in a penalty of the value of such estate with costs, with condition, if judgment or decree be rendered for the plaintiff in such suit, to pay such value, or so much thereof as may be necessary to satisfy the same.