I have seen the word 'righteous' used recently without a real concept as to what it really means. I don't believe there is a verse in the Bible that defines it, but there are numerous verses that mention the word and it is used either as a noun or an adjective (which means it can refer to a person or it describes). Righteousness has to do with the Law of God and our responsibility to that law.
God is supremely righteous and has always been so. We humans have not always been righteous. The first righteous act that we can ever do is to exercise a change in our hearts toward God. This involves a renunciation of selfishness. When one comes to saving faith, he does not do so for selfish reasons. By looking at the character and claims of a righteous God the sinner renounces his self-seeking spirit and comes into harmony with God. Now this is not something that we can do on our own. We can only come to this righteousness through the illumination of the Holy Spirit.
The change in our heart from selfishness to righteousness involves faith or trust in God, that He will keep His promise to forgive us of our sin by the death and resurrection of the Son of God. It also involves repentance of our sins - that is rejecting our selfishness and coming into harmony with God. Faith and repentance are not separate acts but at salvation occur simultaneously.
It must be noted that outward conformity to the Law of God does not constitute righteousness. When doing all the good things that we believe should please God, outwardly conforming to His will, without the Holy Spirit working in our soul - we are being self-righteous. True righteousness does not consist of good acts, but of a changed heart. The righteous acts that we do are the result of the changed heart.
So the question is raised, can we still be righteous if we backslide into sin? If we look at the life of Lot, Abraham's nephew, I think we can find the answer. In Gen. 18:24 in a conversation Abraham has with God, He pleads that God will not destroy the city of Sodom if there are fifty 'righteous' there. Lot lived in that wicked city. God allows Abraham to dicker down to ten, promising He will not destroy Sodom if ten righteous souls are found there. God, in His mercy , sent a couple of angels to save Lot and his family from the destruction. So was Lot righteous? We see in II Peter 2:7 that Peter mentions that God 'rescued righteous Lot.'
But we should realize that although God is extremely merciful, the life of Lot is not the example God would have us pattern our lives after. Lot was a sorry Christian, but he was found righteous by God, not because of his actions, but because earlier in his life, he had a change of heart. That made the difference. God does not want us to follow Lot's example. His biography is placed in the Bible to show that he made some very wrong choices, and ended his life miserably (see Gen. 19:30-38 if you doubt me).
God has invested much in us. First, He gave His best, the Son died for our sins in order that we might be redeemed and become righteous. God has also given His Holy Spirit to dwell in us, so that we can live righteous lives. Remember righteous acts come from a righteous heart in conformity with God's will. Being righteous is not conforming with a long list of 'do nots'; it is allowing the Spirit to live and work in us.
When we think of all the Lord God has done to bring us to Himself and all He has offered to help us live righteously and victoriously, what can keep us from allowing Jesus to reign as King in our lives?