You see, at just the right time, when we were still powerless, Christ died for the ungodly. Very rarely will anyone die for a righteous man, though for a good man someone might possibly dare to die. But God demonstrates his own love for us in this: While we were still sinners, Christ died for us.
-- Romans 5:6-8 NIV.
I will have mercy on whom I have mercy,
and I will have compassion on whom I have compassion.
-- Exodus 33:19 NIV.
...for all have sinned and fall short of the Glory of God, and all are justified freely by his grace through the redemption that came by Christ Jesus. God presented him as a sacrifice of atonement, through faith in his blood. He did this to demonstrate his justice, because in his forbearance he had left the sins committed beforehand unpunished -- he did it to demonstrate his justice at the present time, so as to be just and the one who justifies those who have faith in Jesus.
-- Romans 3:24-26 NIV.
This last beautiful passage concisely describes how Jesus crucifixion represents the perfect expression of both God's justice and his mercy at the same time. Sin cannot go unpunished; the wages of sin is death, and that penalty must be paid. God is not mocked; God takes sin seriously and judges it with death. But in his mercy, God laid the sins of others onto Christ. He imputed their sins to him, and he died for them. So in the cross we meet both God's perfect justice and perfect mercy.