From the appendix of Carol Ruvolo’s book, A Believer’s Guide to Spiritual Fitness:
Since Jesus is God, He is perfectly righteous and holy. God’s perfect righteousness and holiness demand that sin be punished (Ezekiel 18:4), and Jesus’ perfect righteousness and holiness qualified Him to bear the punishment for the sins of those who will be saved (Romans 6:23). Jesus is the only person who never committed a sin; therefore, the punishment He bore when He died on the cross could be accepted by God as satisfaction of His justice in regard to the sins of others.
If someone you love commits a crime and is sentenced to die, you may offer to die in his place. However, if you have also committed crimes worthy of death, your death cannot satisfy the law’s demands for your crimes and your loved one’s. You can only die in his place if you are innocent of any wrongdoing.
Since Jesus lived a perfect life, God’s justice could be satisfied by allowing Him to die for the sins of those who will be saved. Because God is perfectly righteous and holy, He could not act in love at the expense of justice. By sending Jesus to die, God demonstrated His love by acting to satisfy His own justice (Romans 3:26).