Love is the constant that makes both justice and mercy work. It is Christlike love that loves the sinner but doesn't condone the sin or the wrong behavior and instead teaches the way to happiness.
"Mercy, detached from Justice, grows unmerciful. That is the important paradox. As there are plants which will flourish only in mountain soil, so it appears that Mercy will flower only when it grows in the crannies of the rock of Justice; transplanted to the marshlands of mere Humanitarianism, it becomes a man-eating weed, all the more dangerous because it is still called by the same name as the mountain variety. "
Link to the whole essay: https://ojs.lib.byu.edu/spc/index.php/IssuesInReligionAndPsychotherapy/article/viewFile/273/272