I'm having some difficulties in understanding James 2:8-13. When he talks about the royal law in verses 8-11, it clearly refers to some of the ten commandments. But I get confused at verse 12 "So speak and so act, as those who are to be judged by the law of liberty." How does this verse tie into everything James is discussing in this chapter?
Starting in chapter 2, James is discussing that faith isn't shown in partiality. Rich people should not be treated better than poor people. Everyone should be treated alike. He then backs up his point by quoting "You shall love your neighbor as yourself" from Leviticus 19:18. Jesus had said that this was the second most important law in Moses' laws (Matthew 22:36-40), which is why James calls it the royal law. It is one of the two core laws from which all other laws are derived. It is also the core of why faith requires that we treat everyone equally. When you break this law, you are sinning. This particular law is not limited to just the Old Testament. It is also a part of the Law of Christ (Romans 13:8-13).
If you tell yourself, well, I don't commit adultery or murder, so I'm a pretty good guy; yet, you are partial in your treatment of people, then you are breaking the law. One sin is not less important than other sins.
Therefore, whether you see it as important or not, realize that you will be judged by this law. The "law of liberty" is a reference to Christ's law (James 1:25) because Christ came to make us free (John 8:36).
To show partiality is to act without mercy. It is acting without the love required by the royal law. Judgment will be harsher to the merciless (Proverbs 21:13). But when we act as we should, our mercy to others overcomes the judgments required against ourselves.