For while we were still weak, at the right time Christ died for the ungodly. For one will scarcely die for a righteous person—though perhaps for a good person one would dare even to die— but God shows his love for us in that while we were still sinners, Christ died for us. Since, therefore, we have now been justified by his blood, much more shall we be saved by him from the wrath of God.
This is one of the most precious passages in Romans. Here is some commentary from John Piper, in a sermon “The Depth of Christ’s Love: Its Undeserving Objects”
The depth of God’s love for us—and Christ’s love for us—is seen in this: when he chose to love us, even at the cost of Jesus’ life, we were not worthy of his love. In fact we were worthy of his wrath. We deserved his punishment for our sins against him. And his love is shown in this—exactly in this—that his love did not wait for any moral improvement in us. The full sacrifice was made while we were still sinners.