Before faith came, we were kept under the law, shut up. Before the faith was revealed we were confined under the law, as it were in prison, in a state of preparation for the faith which should afterwards be revealed. The law was "added" in order to do a work of preparation until the gospel was revealed. See Galatians 3:19.