When the law is used as a means of self-merit or justification, it is then used unlawfully. Paul said: "For I through the law died to the law that I might live to God" (Gal. 2:19)—he put legalism away and began to live for God. Many in the Church believe the O.T. taught that one could be justified by law but in the N.T. we are justified by faith. The O.T. never taught this.
The Jews failed to see Christ in the law:
Brethren, my heart's desire and prayer to God for Israel is that they may be saved. 2 For I bear them witness that they have a zeal for God, but not according to knowledge. 3 For they being ignorant of God's righteousness, and seeking to establish their own righteousness, have not submitted to the righteousness of God. 4 For Christ is the end of the law for righteousness to everyone who believes. ―Rom. 10:1-4
But their minds were blinded. For until this day the same veil remains unlifted in the reading of the Old Testament, because the veil is taken away in Christ. 15 But even to this day, when Moses is read, a veil lies on their heart. 16 Nevertheless when one turns to the Lord, the veil is taken away. ―2 Cor.s 3:14-16
Is the law then against the promises of God? Certainly not! ―Gal. 3:21
So then, the unlawful use of the law is the attempt to use the law to attain righteousness before God. The law served as an instructor to lead us to Christ (Gal. 3:24). What aspect of the law performed this function? The ceremonial law—the tabernacle, the priests and the sacrifices. We are no longer under this tutor of ceremonial law (Gal. 3:24). It is legalism that is the unlawful use of the law—this is what is opposed by the N.T.
The subject of law is important because we cannot know the gospel [the good news] without the law [the diagnosis]. "…for by the law is the knowledge of sin" (Rom. 3:20). Grace is the only basis of our salvation. The opposite of law is not grace; the opposite of law is lawlessness.