Gal. 3:24 Let me put it another way. The law was our guardian and teacher to lead us until Christ came. So now, through faith in Christ, we are made right with God.
The law was very important and useful in the spiritual life of the Israelites before Jesus came. It made it very clear that everyone was a sinner in need of a Savior. It made it very clear that no one could be made right with God by keeping the law. It made it very clear what God's standards were and what would happen when man did not meet them. The law made it very clear that without God's help, no one could claim to be righteous before Him. The law taught man what to do in order to be righteous before God.
Until Jesus came, no matter how hard man tried, he failed in his quest to be righteous before God based on their ability to keep the law. The Scriptures tell us of those who were righteous before God because of their heart for God, not what they did. Those who believed God and put their trust in Him alone were accepted by Him.
When Jesus came, He fulfilled the law's demands for righteousness. He lived a sinless life and died a sinner's death and through Him we are made righteous before God. It is through the merit of Christ's life, death and resurrection that we now have fellowship with God. In Christ it can be said that we have hearts after God's own heart. In Christ we find all that our souls need. In Christ alone do we find our way to heaven.