The law was given so that man could see the condition of his relationship with God. To be acceptable to Him, we must be perfect, holy and righteous. The law shows just how imperfect, unholy and unrighteous we really are.
All of us have become like one who is unclean, and all our righteous acts are like filthy rags; we all shrivel up like a leaf, and like the wind our sins sweep us away. (Isaiah 64:6)
Contrary to what most of us have heard in church for years, attempting to follow the law is not intended to make us closer to God. Rather, it's to show us just how far away we are from Him. That's why there were all those rules and rituals for offerings and sacrifices in which blood had to be shed. They demonstrated the severity of the consequences of our sins. The penalty of sin is death and nothing less.
The law was established to shame and condemn us by pointing out our faults, our guilt, our sins. It is supposed to stop us from bragging about how good we are and to show us how desperately we need God's mercy. The law's goal is to break through our stubborn pride and lead us to Jesus Christ for salvation.
Now we know that whatever the law says, it says to those who are under the law, so that every mouth may be silenced and the whole world held accountable to God. Therefore no one will be declared righteous in his sight by observing the law; rather, through the law we become conscious of sin. (Romans 3:19-20)
Before this faith came, we were held prisoners by the law, locked up until faith should be revealed. So the law was put in charge to lead us to Christ that we might be justified by faith. Now that faith has come, we are no longer under the supervision of the law. (Galatians 3:23-25)
The law –the Ten Commandments which we Christians hold so dear– was only given to the Israelites at Mt. Sinai. More laws and statutes and regulations were added to govern their conduct, their worship, and even their diet. All of those laws had one very special purpose: It was to show God's greatness to the nations around Israel by what He required of his people –perfection, holiness, righteousness –attributes that have always been unachievable by man. Israel's relationship with God was to be publicly expressed through humility and total reliance upon His grace and mercy.
What other nation is so great as to have their gods near them the way the LORD our God is near us whenever we pray to him? And what other nation is so great as to have such righteous decrees and laws as this body of laws I am setting before you today? (Deuteronomy 4:7-8)
Although, the law was specifically given to the Israelites, we Gentiles have our own version of it written on our hearts. That's so everyone can recognize their spiritual condition and their need for God's gift through His Son.
Indeed, when Gentiles, who do not have the law, do by nature things required by the law, they are a law for themselves, even though they do not have the law, since they show that the requirements of the law are written on their hearts, their consciences also bearing witness, and their thoughts now accusing, now even defending them. (Romans 2:14-15)
We all –both Jew and Gentile alike– know what it is that God desires for us. He wants all of us to have eternal life with Him. And to do that, we have to be perfectly righteous and completely sinless. The law leads us to Jesus Christ who is the only One who can make that become a reality.