Righteousness has always ben the gift of God through faith: Abram, David,Peter and Paul are mentioned as examples.  When repentance is expressed God in his mercy operated through grace and grants forgiveness and a new status in exchange.

Romans 3:21- 4:8