Laws, whether civil or religious, are designed to keep us safe while living in groups, so that we can persevere as imperfect human beings to develop into creatures capable of life-long commitment to another imperfect creature and thus become capable of concern and kindness toward all other creatures.
No person is perfect, no relationship is perfect. But if we resolve to make a relationship work, we can develop peace treaties of love and tolerance to transform a difficult situation into something beautiful. (One may start this, but ultimately it will take two.)
The key to living is not perfection, but perseverance in becoming ever more capable of loving other imperfect beings.
And the most vital part of learning to love ourselves and other imperfect human beings is forgiveness.
And the purpose of forgiveness is grace for personal growth and the ongoing evolution of humanity from survival of the fittest to creatures capable of love for all others.