The purpose of the cy pres doctrine is to allow courts the ability to enforce the wishes outlined in certain legal documents and in certain accounts as closely as possible to the original interpretation. The doctrine comes into play in order to avoid nullifying the document or account, whether it's a trust or a will.