On Monday, the Supreme Court found that two of North Carolina’s congressional districts were gerrymandered, by race, in violation of the Constitution. The 5-3 vote was not along ideological lines. Justice Clarence Thomas voted with the liberal justices to form the majority opinion.

The two congressional districts in question have been in dispute since the 1990s. Some Republicans voters sued the Democratic-controlled state of North Carolina claiming the state used race to created the two districts in violation of the 14th Amendment of Equal Protection Clause. North Carolina argued that they had used race to form the districts, but they did it in order to comply with the Voting Rights Act (VRA). The act allowed historically racist states to create districts for minority voters.

The Supreme Court’s conservative judges voted 5-4 that the districts were in violation of the Constitution’s equal protection. The opinion by the minority liberal judges argued that districts were legal based on the VRA because they afforded minorities the opportunity to choose their own representation.

In 2001, Sandra Day O’Conner joined the liberal justices to ease restrictions on racial gerrymandering. Under this decision, states could gerrymander along partisan lines, even if race and political registration are intertwined.

Now that North Carolina is under Republican control, the 2001 decision allows Republican-dominated states to gerrymander minorities based on their party. Southern states have successfully used this argument to keep their gerrymandered districts, and thus their skewed majorities.

Justice Elena Kagan, in Monday’s majority opinion said, “the sorting of voters on the grounds of their race remains suspect even if race is meant to function as a proxy for other (including political) characteristics.”

On face value, Thomas voting with the liberals seems surprising, but Slate argues it is not. “Thomas is arguably the most consistent justice on racial gerrymandering: He opposes it no matter its ostensible purpose. In the 1990s, Thomas disapproved of race-conscious redistricting designed to empower black Democrats; today, he objects to race-conscious redistricting designed to empower white Republicans. While liberals and conservatives switched sides, Thomas stuck to his guns. And on Monday, his consistency handed Democrats—and the principle of equality—a remarkable victory.”

The real case on gerrymandering will probably be heard next term. Gill v. Whitford challenges partisan redistricting.