The word mercy does not simply mean “letting someone off a punishment which they deserve as a result of misbehaviour”. It also means kindness, generosity and benevolence. The “Good Samaritan” was, in this sense, merciful to the man who had been set upon by thieves and left for dead when he came to his aid. [Lk 10:37] When the Eastern Liturgies cry out over and over “Lord, have mercy!” they are not asking for forgiveness, but rather for Divine assistance.
So far as God is concerned, no created being actually deserves anything of its own right; so all of God’s actions towards creatures are essentially those of mercy not justice. However, it is only proportionate, right and proper that God does act towards creatures with mercy; for else they could not exist and the very act of creation would be made into an absurdity. So, in God justice and mercy do not conflict but are aspects of the same reality.
Moreover, it is also just of God to be merciful to the sinner in view of the fact that God foresees that in the future they will be a saint, if only God is presently merciful. Arguably, the same is true in the human context also. It is just to be merciful; where mercy means giving a culprit a chance to repent and change their ways. It is merciful to be just; where justice means imposing a penalty which is crafted to bring about penitence and reformation in the heart of the wrongdoer.