The Bible paints a rather expansive view of God. We know, among other things, that He is just. Abraham asked, "Shall not the Judge of all the earth deal justly?" (Gen 18:25) with the expected, "Yes, of course!" implied. Paul calls Him "the Lord, the righteous Judge" (2 Tim 4:8). Indeed, it is this justice that gives morality any basis. In order to seek to be moral, one must believe in ultimate justice. If we believe that there may or may not be justice in the end, then there is no reason to seek to be moral.
Another abundantly clear attribute of God is His mercy. In one of my favorite passages we read, "But God, being rich in mercy, because of His great love with which He loved us, even when we were dead in our transgressions, made us alive together with Christ (by grace you have been saved)." (Eph 2:4-5) That's a big "but". And God is "rich in mercy". In Romans there is a contrast drawn between "vessels of wrath prepared for destruction" and "vessels of mercy, which He prepared beforehand for glory" (Rom 9:22-23). Oh, yes, God is indeed merciful.
So we run into a dilemma. Justice, you see, is giving that which is deserved. Human sin demands divine punishment. Mercy, on the other hand, is mercy is defined as not giving that which is deserved. Now, God is unchanging, but it sounds as if He has to set aside one aspect of His nature in order to act on another aspect of His nature. And that's a problem. That's a contradiction. How are we to resolve this?
Relax, dear reader. There is a logical and explicit resolution in Scripture. (I know you were sweating it.) There are those who would like to tell you that "God just forgives. End of story. You do it, right? Well, so does He. It's okay." Except this retains the contradiction. If He just forgives, then He is not just. If He is just, He cannot simply forgive. But Scripture says otherwise. Scripture says that we all are sinners (Rom 3:23) (bad news), but that we are "justified as a gift" (Rom 3:24). How? "Through the redemption which is in Christ Jesus whom God displayed publicly as a propitiation in His blood through faith." (Rom 3:24-25) See that? "Redemption." That is, a payment is made. Elsewhere we read, "In Him we have redemption through His blood" (Eph 1:7). Justice is met. In this "He would be just and the justifier of the one who has faith in Jesus." (Rom 3:26)
The question is, is God Just or Merciful. As it turns out, God is both Just and Merciful. Our sins aren't simply forgiven; they are paid for. We aren't simply released from the just punishment we've earned; Jesus bore that punishment. Only in this way can God be both Just and Merciful. And He is both without contradiction or diminishing of His own nature. God wins!