When you are learning to ride a bicycle, training wheels help in the process. When you have learned, training wheels are in the way. When you are building the walls of a building, scaffolding helps in the process. When the walls are done, the scaffolding is in the way.
When we are learning righteousness, rules help in the process. When we have learned how to listen to the Spirit of the King, rules are a distraction from listening to Him for directions. If someone had managed to prevail on the day Jesus was to be crucified with an enforcement of the law “You shall not kill,” there would have been no Sacrifice.
Why the law then? It was added because of transgressions until the Seed to whom the promise was made would come. The law was ordered through angels by means of a mediator. Now a mediator is not for just one person, but God is one. Is the law therefore contrary to God’s promises? Absolutely not! For if a law had been given that was able to give life, then righteousness would certainly be by the law. But the Scripture has imprisoned everything under sin’s power, so that the promise by faith in Jesus Christ might be given to those who believe. Before this faith came, we were confined under the law, imprisoned until the coming faith was revealed.
The law, then, was our guardian until Christ, so that we could be justified by faith. But since that faith has come, we are no longer under a guardian, for you are all sons of God through faith in Christ Jesus.
For as many of you as have been baptized into Christ have put on Christ. There is no Jew or Greek, slave or free, male or female; for you are all one in Christ Jesus. And if you are Christ’s, then you are Abraham’s seed, heirs according to the promise.
(Galatians 3:19-29 Holman Christian Standard Bible®©)