On granting an order authorizing a sale of homestead, the court may direct that a part of the funds derived from such sale, not to exceed one-third thereof, be set aside, and may direct the investment of such funds for the use and benefit of the mentally ill husband or wife. If such husband or wife dies while mentally ill, the sum so set aside reverts to the surviving husband or wife. If the mentally ill husband or wife survives, then such sum shall descend in accordance with the laws of succession as provided in title 30.1.
N.D.C.C. § 47-18-26