§ 5-331. Certain covenants and restrictions in conveyances and other agreements affecting real property void as against public policy. Any promise, covenant or restriction in a contract, mortgage, lease, deed or conveyance or in any other agreement affecting real property, heretofore or hereafter made or entered into, which limits, restrains, prohibits or otherwise provides against the sale, grant, gift, transfer, assignment, conveyance, ownership, lease, rental, use or occupancy of real property to or by any person because of race, creed, color, national origin, or ancestry, is hereby declared to be void as against public policy, wholly unenforceable, and shall not constitute a defense in any action, suit or proceeding. No such promise, covenant or restriction shall be listed as a valid provision affecting such property in public notices concerning such property. The invalidity of any such promise, covenant or restriction in any such instrument or agreement shall not affect the validity of any other provision therein, but no reverter shall occur, no possessory estate shall result, nor any right of entry or right to a penalty or forfeiture shall accrue by reason of the disregard of such promise, covenant or restriction. This section shall not apply to conveyances or devises to religious associations or corporations for religious purposes, but, such promise, covenant or restriction shall cease to be enforceable and shall otherwise become subject to the provisions of this section when the real property affected shall cease to be used for such purpose.