(a) Except as provided in AS 34.40.110(b), a trust that is covered by AS 13.36.035(c) or that is otherwise governed by the laws of this state, or a property transfer to a trust that is covered by AS 13.36.035(c) or that is otherwise governed by the laws of this state, is not void, voidable, liable to be set aside, defective in any fashion, or questionable as to the settlor's capacity, and the assets of the trust are not subject to the claim of a creditor of the settlor or a creditor of a beneficiary, on the grounds that the trust or transfer avoids or defeats a right, claim, or interest conferred by law on a person by reason of a personal or business relationship with the settlor or beneficiary or by way of a marital or similar right.
(b) If a trust or a property transfer to a trust is voided or set aside under AS 34.40.110(b), then the trust or property transfer shall be voided or set aside only to the extent necessary to satisfy the settlor's debt to the creditor or other person at whose instance the trust or property transfer is voided or set aside and the costs and attorney fees allowed under the rules of court.
(c) If a trust or a property transfer to a trust is voided or set aside under (a) of this section, and if the court is satisfied that the trustee has not acted in bad faith in accepting or administering the property that is the subject of the trust,
(1) the trustee has a first and paramount lien against the property that is the subject of the trust in an amount equal to the entire cost, including attorney fees, properly incurred by the trustee in a defense of the action or proceedings to void or set aside the trust or the property transfer;
(2) the trust or property transfer that is voided or set aside is subject to the proper fees, costs, preexisting rights, claims, and interest of the trustee and any predecessor trustee that have not acted in bad faith; and
(3) the beneficiary, including the settlor, may retain a distribution made by exercising a trust power or discretion vested in the trustee of the trust, if the power or discretion was properly exercised before the commencement of the action or proceeding to void or set aside the trust or property transfer.