"...so that you may be justified in your words and blameless in your judgment." What an interesting thing for a man who's confessing sin to say! Why would David be talking about God's justice? Now, it makes sense when you have the sense to confess, to remind God of his mercy, but to stand before him and remind him of his justice is another thing all together.
Let me suggest that there are two ways that the justice of God should comfort we sinners. First, his justice means that his assessment of me is accurate. It isn't colored or slanted by prejudice or bias of any kind. It isn't shaped by any kind of hidden personal agenda. God's assessment isn't weakened by favoritism or the cynicism of previous experience. God's view of me is pure and accurate in every way. What he says about me is absolutely true. Every judgment he would make of wrong attitude, thought, desire, choice, word, or action, is valid and true.
Unlike my experience in this broken world, I don't have to fear that God will wrongly associate me with some group, or have his view of me colored by a grudge, or have his perspective on me colored by irritation or impatience. I can rest assured that God's view of me is trustworthy in every way. And because God's view of me is untainted by sin, it's clearly more reliable than any view that I'd have of myself.
Second, the way that God responds to me as Judge is right and pure as well. God's discipline of me is without personal bias. It isn't weakened by anger or impatience. His justice is never distorted because he's lost his temper or is tired of dealing with me. To add to this, since he isn't only just, but merciful, loving, and kind as well, God's justice is always restrained and tempered by these things. He's a God of mercy who meets out justice. He disciplines us in love. His kindness colors how he responds to the sins of his children.
The way that God exercises his power is without blemish. He isn't like the leaders we're used to, who use power for personal control or privilege. He isn't like a leader who has an inner circle of sycophants that he treats differently than he does everyone else. He doesn't use his power to place people in his debt or to use situations to his advantage. His justice is the benevolent justice of a holy king.
So, I can place myself in the hands of the justice of the one who sees me with accuracy and deals with me righteously. But there's even something more here. Unlike David who looked forward to the coming of his future "son," the Lord Jesus Christ, we look back on his life on our behalf. We stand before God unafraid, not because we're acceptable to him, but because his justice has been satisfied by the death of Jesus. So, God is to us both the One who's just and the One who justifies! He can forgive my rebellion and sin without compromising the purity of his justice in any way!
I don't have to manipulate God's view of me.
I don't have to run from him in fear.
I don't have to rationalize away my wrongs.
I don't have to work to shift the blame to someone else.
I don't have to put forward false pretenses.
I don't have to marshal arguments for my acceptability.
I don't have to try to buy my way into his favor.
No, I can be who I am and what I am and stand in the light of his righteousness without fear, because Jesus has taken my sin and suffered my stripes. So the One who is my Judge is also my Justifier. There is rest! There is hope!