Some have viewed God as having to forfeit his righteous demands in order to be able to forgive. Nothing could be further from the truth. It is precisely because God will always do what he has promised and at the same time do and be what is right that he forgives.
C.H. Dodd puts it quite eloquently:
God’s attitude to us, His purposes for us, do not alter because we sin against Him. When we turn to Him again, we find Him still the same. If we confess our sins, and in confession repudiate them, then God forgives, not (as a man might) because He chooses on this occasion to be indulgent or considerate, or tolerant, but because no other course would be consistent with the perfectly good will by which the whole universe is created and sustained. It is this, and this only, in the last resort, that justifies our confidence of being forgiven our repeated offences against the law of God. We believe in the forgiveness of sin, not by convincing ourselves that our sins were excusable or remediable, or that we meant well, or that ‘we won’t do it again’. It is because the principle of forgiveness is built into the structure of a moral order created and determined by the character of a just and faithful God…. The probability is that an effective appreciation of our own sinful condition is in most cases not (as is often supposed) a preliminary to the hearing of the Gospel, but a consequence of it.— The Johannine Epistles, p. 23.