The U.S. Supreme Court has affirmed a lower-court ruling throwing out congressional district maps North Carolina used for the 2012 and 2014 elections. The lower court cited racial gerrymandering. Justices split, 5-3, on whether the ruling should apply to both of the state’s majority-minority congressional districts.

New Justice Neil Gorsuch took no part in the case.

The ruling does not impact the 2016 elections. North Carolina conducted those elections under new maps drawn to comply with the original February 2016 ruling from a three-judge panel. The 2016 maps face their own legal challenge. Federal judges are scheduled to hear arguments in that challenge in June.

At issue in Cooper v. Harris, the case before the Supreme Court, was whether the 1st and 12th congressional Districts violated a constitutional prohibition against racial gerrymandering. A three-judge district panel had ruled in February 2016 that both districts failed to meet the constitutional standard.

The majority opinion, written by Justice Elena Kagan, agreed with the lower court. Kagan writes that N.C. legislators misinterpreted Supreme Court precedent in designing districts with a majority of African-American voters. Kagan also rejected the legislators’ argument that the 12th District’s design was based on political, rather than racial, factors.

“Applying a clear error standard, we uphold the District Court’s conclusions that racial considerations predominated in designing both District 1 and District 12,” Kagan writes. “For District 12, that is all we must do, because North Carolina has made no attempt to justify race-based districting there.”

“For District 1, we further uphold the District Court’s decision that [Section] 2 of the [Voting Rights Act] gave North Carolina no good reason to reshuffle voters because of their race,” Kagan added.

Justice Clarence Thomas joined in the majority opinion and wrote a separate concurrence. Thomas noted that, in his view, Kagan’s opinion corrected a prior mistake in redistricting cases.

Justices Samuel Alito and Anthony Kennedy joined Chief Justice John Roberts in supporting part of the majority ruling and opposing part. Alito’s dissent explained why the three judges disagreed with their colleagues on the argument surrounding the 12th District. Specifically, they chided their colleagues for ignoring a previous precedent that seemed to require opponents of a redistricting plan to present an “alternative” map.

“A precedent of this Court should not be treated like a disposable household item—say, a paper plate or napkin— to be used once and then tossed in the trash,” Alito writes. “But that is what the Court does today in its decision regarding North Carolina’s 12th Congressional District: The Court junks a rule adopted in a prior, remarkably similar challenge to this very same congressional district.”

“The alternative-map requirement deserves better,” Alito added. “It is a logical response to the difficult problem of distinguishing between racial and political motivations when race and political party preference closely correlate.”

Even without an alternative map, Alito and the other two dissenters disagree with their colleagues about the 12th District. “The State offered strong and coherent evidence that politics, not race, was the legislature’s predominant aim, and the evidence supporting the District Court’s contrary finding is weak and manifestly inadequate in light of the high evidentiary standard that our cases require challengers to meet in order to prove racial predominance.”

Gov. Roy Cooper responded to the ruling. “North Carolina voters deserve a level playing field and fair elections, and I’m glad the Supreme Court agrees,” Cooper said in a prepared statement. “The North Carolina Republican legislature tried to rig Congressional elections by drawing unconstitutional districts that discriminated against African Americans, and that’s wrong.”

N.C. Republican Party Chairman Robin Hayes lamented the latest instance of the nation’s highest court changing the rules. “Our position continues to be the same as the Obama Justice Department on this issue, which precleared these districts as fair and legal,” Hayes said in a prepared statement. “I don’t know how any legislature can perform this task when the rules change constantly from case to case, often after the fact.”

The latest ruling says nothing about North Carolina’s legislative districts, which also have been subjected to a court challenge that has reached the nation’s highest court.