Because sin had imprisoned us (3:22), the law of Moses acted as a guard, keeping God's people safe (held in custody) until faith in Jesus was revealed. It clearly showed God's requirements and emphasized the need for a Savior. The law also kept sin under control by clearly showing its consequences.