The U.S. Supreme Court ruled Thursday that partisan gerrymandering is a political issue outside the purview of the federal courts, a major blow to activists who contend the practice of parties drawing political maps to improve their election odds is fundamentally anti-democratic and unfair to voters.

The Supreme Court had never overturned a map as an unconstitutional partisan gerrymander, saying it lacks a clear standard for doing so. Last year it punted on two cases.

Thursday’s ruling shut the doors altogether on federal intervention and increased the importance of state courts as an avenue for challenging political maps. It also makes last year’s Pennsylvania Supreme Court gerrymandering case a model for other states.

“Federal courts are neither equipped nor authorized to apportion political power as a matter of fairness. It is not even clear what fairness looks like in this context,” Chief Justice John G. Roberts Jr. wrote in the 5-4 opinion. He was joined by Justices Clarence Thomas, Samuel A. Alito Jr., Neil M. Gorsuch, and Brett M. Kavanaugh.

Roberts cited several possible criteria for fairness.

“Deciding among those different visions of fairness poses basic questions that are political, not legal,” he wrote. “There are no legal standards discernible in the Constitution for making such judgments. And it is only after determining how to define fairness that one can even begin to answer the determinative question: 'How much is too much?’”

The court’s more liberal wing, Justices Elena Kagan, Ruth Bader Ginsburg, Stephen G. Breyer, and Sonia Sotomayor, dissented.

“Of all times to abandon the court’s duty to declare the law, this was not the one," Kagan wrote. "The practices challenged in these cases imperil our system of government. Part of the court’s role in that system is to defend its foundations. None is more important than free and fair elections.”

The case, one of the most watched of the current Supreme Court term, came two years before the next round of mapping, amid a rise in efforts nationwide aimed at combating partisan gerrymandering. The issue had long been seen as esoteric, but a surge of grassroots activism, in Pennsylvania and elsewhere, has turned gerrymandering into a major political issue. Former President Barack Obama has focused on the issue since leaving office.

Much of activists’ recent attention has focused on the ballot box — voters in Michigan, Colorado, Missouri, and Utah, for example, approved redistricting reform measures in November — and on the state courts, which remain an open avenue for partisan gerrymandering challenges.

“As people in Pennsylvania well know, the fight against gerrymandering has always been a multi-front war, and on those other fronts, it not only continues but seems to be going well,” said Michael Li, a redistricting expert at the Brennan Center for Justice at New York University.

Last year, the Pennsylvania Supreme Court struck down the state’s congressional map as violating the state constitution, demonstrating how state constitutions can be used to overturn maps for excessive partisan gerrymandering even if federal courts have no say.

“The focus is really going to be on state courts now as the only way,” said Joshua A. Douglas, a law professor at the University of Kentucky. “The federal courts are closed.”

What were the Supreme Court cases decided Thursday?

Benisek v. Lamone accused Maryland’s Democratic-controlled legislature of drawing a U.S. House district in 2011 to flip a safe Republican seat to a safe Democratic one.

The Supreme Court had sent the case back to District Court on technical grounds last year. The lower court ordered the map redrawn, prompting the appeal.

In Rucho v. Common Cause and Rucho v. League of Women Voters of North Carolina, the Republican-controlled North Carolina legislature was accused of drawing its congressional districts to favor Republicans after the previous one was overturned as a racial gerrymander.

The cases were consolidated.

“The court’s not saying partisan gerrymandering is necessarily allowed, it’s simply saying, ‘We can’t be the umpire,’” Douglas said.

Racial gerrymandering cases, which have a strong history in federal courts, still will be allowed, but partisan cases will have to go through state courts.

The Pennsylvania factor

Last year, the Pennsylvania Supreme Court overturned the state’s congressional map, which was drawn in 2011, as an unconstitutional partisan gerrymander favoring Republicans.

In a state in which votes generally have been split about equally between Republicans and Democrats in statewide and federal contests, in congressional election after election the same 13 seats went to Republicans and the same five to Democrats.

The state high court said the maps violated the state constitution’s guarantee that “elections shall be free and equal.”

>>READ MORE: Pennsylvania, gerrymandered: A guide to Pa.’s congressional map redistricting fight

That decision provided a model for state challenges to political maps, experts said.

Unlike the U.S. Constitution, state constitutions explicitly protect the right to vote. A state court can find a map violates a state constitution even when a federal court doesn’t find a U.S. constitutional violation.

“Pennsylvania’s a big model. I think people were a bit skeptical of whether state constitutions provided much more than the federal Constitution,” Li said. The Pennsylvania Supreme Court provided an answer.

The case already been cited as blueprint.

What about other options for addressing gerrymandering?

While state courts are now the only judicial recourse for challenging a political map, other options to prevent gerrymandering are available, including ballot propositions and actions by state lawmakers and Congress.

In some states — not Pennsylvania — voters have approved measures that set standards for how political maps are drawn and/or take lawmakers out of the process.

Congress could pass laws affecting how maps are drawn by the states. House Democrats included preventing gerrymandering in a wide-ranging bills this year , but that is unlikely to go anywhere in the current Congress.

Lawmakers in Harrisburg could change the redistricting process. Last year the grassroots advocacy group Fair Districts PA was able to advance legislation to create an independent commission of citizens to draw political maps. That failed, though, and it’s too late for passage of the required constitutional amendment in time for the 2021 redistricting round. But the group believes it can still accomplish its goals through standard legislation.