If, upon such examination, or, upon the verdict of a jury as provided in section eighty-one, it appears that the mortgage, pledge, lien or contract of conditional sale is valid, the court, having first ascertained the amount justly due upon it, may direct the attaching creditor to pay the same to the mortgagee, pledgee, lienor or conditional vendor, or his assigns, within such time as it orders; and if he does not pay or tender the amount within the time prescribed the attachment shall be void and the property shall be restored.
Mass. Gen. Laws ch. 223, § 80