Mercy and Justice are not opposites, enemies or contradictions of each other.
They are two ends of the same stick, the Shepherd's staff. One end , the "rod", pokes and prods the sheep into the Shepherd's way or drives the wolf away. The other end is a secure hook which lifts and pulls the sheep to safety into the Shepherd's will and way, and for the sheep's welfare, which is the same thing. The Shepherd leads his "flock" in that way; he does not "herd" them. Willful, obedient and healthy followers of their Shepherd to green pastures, still waters, restoration and paths of righteousness is the Shepherd's desire for his sheep.
Psalms 23:1 The LORD is my shepherd; I shall not want.
Psalms 23:2 He maketh me to lie down in green pastures: he leadeth me beside the still waters.
Psalms 23:3 He restoreth my soul: he leadeth me in the paths of righteousness for his name's sake.
Psalms 23:4 Yea, though I walk through the valley of the shadow of death, I will fear no evil: for thou art with me; thy rod and thy staff they comfort me.
Psalms 23:5 Thou preparest a table before me in the presence of mine enemies: thou anointest my head with oil; my cup runneth over.