The Supreme Court heard arguments Monday in a congressional redistricting case that involves the complicated issues that arise under the Voting Rights Act and the Equal Protection Clause of the Fourteenth Amendment when race intersects with politics.

Experienced Supreme Court litigator Mike Carvin was up against Marc Elias, who is the attorney for Hillary Clinton’s presidential campaign, although he was not acting in that capacity in this case.

Virginia has eleven congressional districts. Eight are represented by Republicans and three by Democrats. One congressional district, District 3, is majority/minority district under the Voting Rights Act (i.e., it has a majority of black voters and is represented by a black Democrat, Rep. Bobby Scott, D-Va).

After Republicans gained control of the state legislature in 2012, they enacted a new congressional redistricting plan based on the 2010 Census that, in essence, preserved District 3 as a majority/minority district as required under the Voting Rights Act.

District 3 was treated the same as all of the other congressional districts in the state, which are majority white districts, by preserving its core and making relatively minimal changes to benefit the incumbents.

The black voting-age population in District 3 was barely changed; it went from 53.1 percent in the prior plan (passed by Virginia Democrats) to 56.3 percent in the new plan. In fact, all of the congressional incumbents were consulted by the state legislature and agreed to the new plan, including Rep. Bobby Scott.

The Republican plan was submitted to the U.S. Justice Department for review under Section 5 of the Voting Rights Act and was precleared without any problems. It was actually used in the 2012 and 2014 elections.

A group of Virginia voters filed a lawsuit in 2013, claiming that race had been the predominant factor considered by the legislature in the redistricting process. If true, it would violate a 1993 Supreme Court case, Shaw v. Reno.

A three-judge panel, in a split decision, found such a violation, but that decision was vacated by the Supreme Court in 2015 and sent back down to the three-judge panel with instructions to reconsider the issue. The three-judge panel issued a virtually unchanged decision finding a violation again.

Carvin, on behalf of the eight Republican legislators who intervened in the lawsuit to defend the enacted plan, argued that the lower court did not follow Supreme Court precedent in its findings.

It never concluded that race was the predominant factor in what the Virginia legislature had done; Carvin told Justice Ruth Bader Ginsburg in answer to a question that the lower court “found that incumbency protection and politics were inarguably motiving” the legislature when it drew the new plan.

Yet the lower court found a violation of the law even though it concluded that the legislature drew “the Third Congressional District in pursuit of the compelling state interest of compliance with Section 5” of the Voting Rights Act, which required Virginia to preserve the ability of black voters to elect their candidate of choice—Scott.

In other words, Virginia was being told by the lower court that it had violated the law because it tried to comply with the requirements of the Voting Rights Act, a bizarre Catch-22.

But Carvin argued that the legislature was pursuing “exactly the same incumbency protection and political motivation with respect to District 3” as it had with all of the other congressional districts in the state, and that the legislators could not somehow be disabled “from doing that simply because the predominantly Democratic voters happen to be black.”

That goal was obviously realized since all of the incumbents, including Scott, were re-elected after the plan was put in place.

Carvin told the Supreme Court that the real motivation of the plaintiffs is not race, but to help Democrats. The alternative plan the plaintiffs proposed actually dropped the black voting-age population in District 3 by three percentage points to 50 percent, making it much more questionable whether black voters could elect their candidate of choice.

But that shifting of voters would convert District 2, with a brand-new Republican incumbent, to what the “plaintiffs themselves characterize as a heavily Democratic district.” The real purpose of the alternative plan, according to Carvin, “was to create two black opportunity districts” for Democrats, which made it “more race-conscious” than the enacted plan they are challenging.

Although the state of Virginia was in the Supreme Court, it was not defending the congressional redistricting plan. It had done so initially when Ken Cuccinelli, a Republican, was the Virginia attorney general.

But the state changed its position when Mark Herring, a Democrat, was elected in 2013. This raised a laugh in the courtroom when Justice Samuel Alito asked the lawyer from the Virginia Office of the Attorney General, Stuart Raphael, whether anything had happened “between the time when your office took the prior position and your appearance here today[.]”

Raphael was forced to explain away a question from Chief Justice John Roberts about the plaintiff’s own expert, who had admitted that if all of the voters transferred between different districts had been white, “the [political] results would still be the same.” That makes it difficult to conclude that race as opposed to partisan politics was the predominant, motivating factor in the redistricting plan.

Elias argued that because the state of Virginia had twice decided not to appeal the lower court decision (after a Democrat took over the attorney general’s office), the members of Congress affected by the decision don’t have standing to defend the plan. Justice Alito was clearly perturbed by Elias’ argument.

He asked Elias:

If it were the case that a State decided not to defend the Constitution, not to defend the legality of a districting plan that was adopted by the legislature, and that decision was made purely for partisan reasons, you would say that an elected official or a candidate who was severely adversely affected by that should not be able to challenge it?

Elias’ answer, shockingly, was “that is correct.” But it got worse. When Alito asked if anyone would be able to challenge such a decision if it was made not for partisan reasons, but for “racist” reasons, Elias said such a decision still could not be challenged.

Ian Gershengorn, the deputy solicitor general of the Obama administration, also appeared before the Supreme Court to argue in support of Elias’ clients against the very same congressional redistricting plan that the Justice Department previously found was not discriminatory under the Voting Rights Act. He agreed with Elias that the members of Congress affected by this plan had no standing to sue—quite a position to take, given the arguments over partisan or racist motivations that Elias had just made.

With eight justices, it is not clear how this case will be decided. But that decision will certainly affect congressional races in Virginia in 2016 and potentially other races across the country, depending on how extensive the ruling is in explaining when race overrides political motivations.