The court or the jury shall determine the rights of the parties and the court shall enter judgment accordingly, and the court shall direct the sheriff or coroner as to the disposition of the property in the possession of the sheriff or coroner. In case the property appears to belong to the claimant, when the claimant is any person other than the judgment debtor or the defendant in the attachment, or in case the property is found to be exempt from enforcement of a judgment thereon or attachment, when the claimant is the judgment debtor or the defendant in the attachment, judgment shall be entered against the judgment creditor or plaintiff in the attachment for the costs, and the property levied on shall be released, and in case it further appears that such claimant is entitled to the immediate possession of such property, the court shall order that such property be delivered to such claimant. If it appears that the property does not belong to the claimant, or is not exempt from the enforcement of a judgment thereon or attachment, as the case may be, judgment shall be entered against the claimant for costs, and an order shall be entered that the sheriff or coroner proceed to sell the property levied on. The judgment in such cases shall be a complete indemnity to the sheriff or coroner in selling or restoring any such property, as the case may be.
735 ILCS 5/12-204