Galatians 3:24

24 So the law was our guardian until Christ came that we might be justified by faith.

Read Galatians 3:24 Using Other Translations

Wherefore the law was our schoolmaster to bring us unto Christ, that we might be justified by faith.
So then, the law was our guardian until Christ came, in order that we might be justified by faith.
Let me put it another way. The law was our guardian until Christ came; it protected us until we could be made right with God through faith.