Well then, why was the law given? It was given to show people how guilty they are. But this system of law was to last only until the coming of the child to whom God's promise was made. And there is this further difference. God gave his laws to angels to give to Moses, who was the mediator between God and the people.
Now a mediator is needed if two people enter into an agreement, but God acted on his own when he made his promise to Abraham.
Well then, is there a conflict between God's law and God's promises? Absolutely not! If the law could have given us new life, we could have been made right with God by obeying it.
But the Scriptures have declared that we are all prisoners of sin, so the only way to receive God's promise is to believe in Jesus Christ.
Until faith in Christ was shown to us as the way of becoming right with God, we were guarded by the law. We were kept in protective custody, so to speak, until we could put our faith in the coming Savior.
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.
But now that faith in Christ has come, we no longer need the law as our guardian.