In Genesis 18 , God comes to Abraham to inform him of His plans to destroy Sodom and Gomorrah. Abraham is interested because his nephew Lot and his family live there. Abraham begins to plead with God to show mercy and refrain from destroying the righteous with the wicked. God agrees to spare the people if there are 50 righteous people in the Sodom. There are not 50. Then he agrees to spare the people if there are 45 righteous found. There are not 45. Then 40, 30, 20, and 10. The presence of only 10 righteous people in Sodom would have spared the population. However, there were not even 10. You can see the pattern, the righteous has the ability to save the wicked.
So one day, God finds not 50 or 45 or 40 or 30 or 20 or 10 righteous. He finds one righteous. And because of the one who is righteous, an innumerable host of the wicked is saved. The righteous one who dies in place of the wicked is Jesus Christ. Because of Him there is the salvation of many. The righteous work of Jesus Christ in His life and His death makes the mercy and grace of God toward us sure and able to escape the just punishment of a righteous God. Jesus Christ is the righteous saving the wicked.