Read Galatians 3:23 Using Other Translations
But before faith came, we were kept under the law, shut up unto the faith which should afterwards be revealed.
Now before faith came, we were held captive under the law, imprisoned until the coming faith would be revealed.
Before the way of faith in Christ was available to us, we were placed under guard by the law. We were kept in protective custody, so to speak, until the way of faith was revealed.