(a) A trustee may resign in accordance with the terms of the trust instrument, or a trustee may petition a court for permission to resign as trustee.
(b) The court may accept a trustee's resignation and discharge the trustee from the trust on the terms and conditions necessary to protect the rights of other interested persons.