LEONARD, Judge,
delivered the opinion of the court.
It is well settled in our equity law, and it seems, too, in the legal systems of other countries, that the surety is entitled to the benefit of all the securities for the debt taken by the creditor from the principal debtor, and is therefore discharged from liability to the extent to which the creditor has parted with these securities ; and this is agreeable to natural equity. (1 Story’s Eq. § 327, et seq.) Accordingly, in a case like the present, (Calvert v. The London Dock Company, 2 Keen’s Rep. 639,) where a contractor undertook to perform certain work, and it was agreed that three-fourths of the work, as furnished should be paid for every two months, and the remaining fourth upon the completion of the work, the Master of the Rolls, Lord Langdale, decided that the sureties for the due per*251formance of the contract were released from their liability by reason of payments, exceeding three-fourths of the work done, haying, without their consent, been made to the contractor before the completion of the whole work. The same principle is applied in the present case, and, although the defence grows out of an equitable and not a legal right, and in the English case the relief was given in equity and not at law, yet under our present system of procedure-it maybe relied upon as a de-fence to a suit upon the legal liability, if all the necessary parties are before the court. The contract duty of this builder was to furnish the materials and do the labor, and he failed in both respects when he allowed the building to be encumbered with these liens. The owner having notice of them, and paying what by the substantial terms of the contract he was entitled to retain until they were removed, voluntarily abandoned an ample fund, which, according to the conditions of the contract, was to accumulate in his own hands as the primary security for its due performance, and in which the surety had an equal interest with himself. He must, therefore, bear the loss occasioned by his own negligence or folly. The judgment is affirmed.