(1) Upon the application of a trustee of the trust or any qualified beneficiary, a court at any time may modify the terms of a trust that is not then revocable in the manner provided in subsection (2), if:
(a) The purposes of the trust have been fulfilled or have become illegal, impossible, wasteful, or impracticable to fulfill;
(b) Because of circumstances not anticipated by the settlor, compliance with the terms of the trust would defeat or substantially impair the accomplishment of a material purpose of the trust; or
(c) A material purpose of the trust no longer exists.
(2) In modifying a trust under this section, a court may:
(a) Amend or change the terms of the trust, including terms governing distribution of the trust income or principal or terms governing administration of the trust;
(b) Terminate the trust in whole or in part;
(c) Direct or permit the trustee to do acts that are not authorized or that are prohibited by the terms of the trust; or
(d) Prohibit the trustee from performing acts that are permitted or required by the terms of the trust.
(3) In exercising discretion to modify a trust under this section:
(a) The court shall consider the terms and purposes of the trust, the facts and circumstances surrounding the creation of the trust, and extrinsic evidence relevant to the proposed modification.
(b) The court shall consider spendthrift provisions as a factor in making a decision, but the court is not precluded from modifying a trust because the trust contains spendthrift provisions.
(4) The provisions of this section are in addition to, and not in derogation of, rights under the common law to modify, amend, terminate, or revoke trusts.