While popularity may be irrelevant, being "right" in the eyes of the people is what justice is all about. After all, the civil rights movement was fairly unpopular for a large part of the U.S. population. Regardless, the legal precedents set during that time were "right" and just.
You contradicted yourself from one sentence to the next.
The population overwhelmingly supported oppressing the black minority. But the legal system disregarded what the large majority thought and did the right thing anyways.