It has often been said that legalism and antinomianism are two opposite poles of theology which need to be guarded against. Throughout Christian history, these two errors have been prominent, and careful theologians have attempted to keep a clear path between the two with a balanced approach to grace and works within the Christian life. Though they seem to be different errors, they really have the same basic problem: a failure to understand the two kinds of righteousness.
For Luther, Christian righteousness is twofold: on the one hand, passive righteousness is given freely by God unto salvation. In one’s relationship to God (coram Deo) it is this righteousness, and this righteousness alone which avails. On the other hand, Christians are called to live in this world for the good of others. In the earthly ream (coram mundo), Christians are called to be obedient to God’s will. These two kinds of righteousness must both be proclaimed boldly, but also must be consistently distinguished.
Legalism and antinomianism essentially have the same error. Both reject the two kinds of righteousness by clinging only to one type of righteousness. The problem with the medieval church was that theologians taught only one kind of righteousness: active righteousness. The Christian’s works were viewed, not only as efficacious in the world before others (coram mundo) but also as meritorious before God (coram Deo). This is legalism. It is argued that because law-keeping is necessary for the Christian, then this law-keeping must establish one’s standing with God. On the other hand, others have rightly rejected this type of works-righteousness, but have fallen into the same error of holding to only one kind of righteousness: passive righteousness. Joel Biermann and Charles Arand explain this connection well:Lutheranism in the twenty-first century finds itself in a unique situation. For the past five hundred years it has fought against conceiving of life only in terms of one kind of righteousness whereby human performance provided the basis for making the claim that God must accept us. But at times in the twentieth century, Lutheranism itself fell into its own form of one kind of righteousness whereby our passive righteousness before God became all we needed. And so active righteousness in conformity with the Law was left unstressed or was transformed into Gospel ways of talking.
The solution to both antinomianism and legalism is the same: the two kinds of righteousness. Every error related to legalism or antinomianism goes back to a confusion of this distinction. Before God, works have no merit whatsoever, and one is dependent solely upon the merit and righteousness of Christ. This is where assurance is to be found. Before the world, works matter, and we should strive to be obedient to God’s law in love toward the world around us.
 Arand, Charles and Joel Biermann, “Why Two Kinds of Righteousness?,” 126.