If God declares us righteous through faith alone, what is the purpose of the law? The law is like a schoolmaster that shows us that we are sinners before a Holy God. The law shows us that our sins have separated us from God, and we are lost apart from divine intervention. The law shows us that we need a Savior. This is good news! When we were lost and completely unable to save ourselves, God sent his Son that all who received him might be declared righteous by God himself.
What, then, was the purpose of the law? It was added because of transgressions until the Seed of whom the promise referred had come…Is the law, therefore, opposed to the promises of God? Absolutely not! For if a law had been given that could impart life, then righteousness would certainly have come by the law…So the law was put in charge to lead us to Christ that we might be justified by faith. – Galatians 3:19-24.