Remember that Paul, as a Jew, had known and loved the law since he was a child. He had received the most advanced training in the law from the leading teacher, Gamaliel (Acts 22:3 cf. Acts 5:34). While he had been a faithful member of Judaism, Paul had tried in all good conscience to keep the law perfectly (Acts 23:1; Philippians 3:4-6). Yet this same Paul was the New Testament writer chosen by God to emphasize the deadly effects of the law. Notice 2 Corinthians 3 in which Paul, guided by the Holy Spirit, contrasted the law of Moses with the New Covenant of Christ.
[God] has made us sufficient to be ministers of a new covenant, not of the letter but of the Spirit. For the letter kills, but the Spirit gives life. Now if the ministry of death, carved in letters on stone, came with such glory that the Israelites could not gaze at Moses’ face because of its glory, which was being brought to an end, will not the ministry of the Spirit have even more glory? For if there was glory in the ministry of condemnation, the ministry of righteousness must far exceed it in glory. Indeed, in this case, what once had glory has come to have no glory at all, because of the glory that surpasses it. For if what was being brought to an end came with glory, much more will what is permanent have glory. (2 Corinthians 3:6-11)