(1) In every case in which different construction liens are claimed against the same property, the court shall declare the rank of such lien or class of liens, which liens shall be in the following order:
(a) Liens for the performance of labor;
(b) Liens for contributions owed to employee benefit plans;
(c) Liens for furnishing material, supplies, or equipment;
(d) Liens for subcontractors, including but not limited to their labor and materials; and
(e) Liens for prime contractors, or for professional services.
(2) The proceeds of the sale of property must be applied to each lien or class of liens in order of its rank and, in an action brought to foreclose a lien, pro rata among each claimant in each separate priority class. A personal judgment may be rendered against any party personally liable for any debt for which the lien is claimed. If the lien is established, the judgment shall provide for the enforcement thereof upon the property liable as in the case of foreclosure of judgment liens. The amount realized by such enforcement of the lien shall be credited upon the proper personal judgment. The deficiency, if any, remaining unsatisfied, shall stand as a personal judgment, and may be collected by execution against any party liable therefor.
(3) The court may allow the prevailing party in the action, whether plaintiff or defendant, as part of the costs of the action, the moneys paid for recording the claim of lien, costs of title report, bond costs, and attorneys' fees and necessary expenses incurred by the attorney in the superior court, court of appeals, supreme court, or arbitration, as the court or arbitrator deems reasonable. Such costs shall have the priority of the class of lien to which they are related, as established by subsection (1) of this section.
(4) Real property against which a lien under this chapter is enforced may be ordered sold by the court and the proceeds deposited into the registry of the clerk of the court, pending further determination respecting distribution of the proceeds of the sale.