Galatians 3:23 But before faith came, we were kept in custody under the law, being shut up to the faith which was later to be revealed.
23a Before faith came,
Old Testament faith was in the Messiah revealed by the prophets and New Testament saints exercise faith in the Christ who has come.
23b We were kept in custody under the law,
Before faith–Christ came– the law was a custodian for all unsaved people. The law holds people in a spiritual prison. “The law confines and shackles a person spiritually so they are not free. The law is a prison for those who have not obtained grace. Obedience is inspired by fear.” (Martin Luther, Commentary on Galatians).
23c being shut up to the faith which was later to be revealed.
The law shuts up all unsaved men in a spiritual prison of sin, but Christ, who has been revealed and died for sinners, can set men free from the spiritual bondage of the law. The law should cause a man to flee to Christ for salvation, for no person has a righteousness which can make him acceptable before God. Salvation is by grace through faith in Christ, and salvation will bring a person peace with God.