WASHINGTON – A deeply divided Supreme Court ruled Thursday that federal courts may not intervene to block even the most partisan election maps drawn by state lawmakers, a decision that allows such gerrymandering to continue unabated.

The 5-4 opinion by Chief Justice John Roberts, who was joined by the court's other conservatives, said partisan election maps drawn by North Carolina Republicans and Maryland Democrats are constitutional despite their one-sided nature.

It was a dramatic withdrawal by the nation's highest court from the political battles that have consumed states for decades, and it was loudly denounced by the court's liberal justices.

“How do you decide where the line is between acceptable partisanship and too much partisanship?” Roberts said from the bench in announcing his ruling on the last day of the term. “At some point, it should occur to you that what you’ve been asked to do is not judging at all."

The chief justice said the challengers from North Carolina and Maryland asked for “an unprecedented expansion of judicial power” that would have broad consequences. “There will be no end to the litigation,” he said.

Associate Justice Elena Kagan decried the ruling on behalf of the court's four liberals. "Of all the times to abandon the court's duty to declare the law, this was not the one," she said. "The practices challenged in these cases imperil our system of government."

More:Supreme Court orders further fact-finding on controversial 2020 census citizenship question

The ruling addresses the way election districts are redrawn once every decade in most states – a system dominated by political self-interest that has grown more intense every time the Supreme Court declined to tame it.

The high court has never declared unconstitutional an election map drawn for blatant partisan advantage. Justices reasoned that elected officials are expected to joust for power in that fashion, while courts should be reluctant to intercede.

Challengers were betting that this year, with these maps, the court might see things differently. In relatively "purple" North Carolina, where President Barack Obama won in 2008 but lost in 2012, Republicans drew themselves a 10-3 advantage in Congress. In more liberal Maryland, Democrats gave their party a disproportionate 7-1 majority.

The court declined to intervene in similar cases five times before, most recently last year, when the justices refused to decide partisan gerrymandering challenges in Wisconsin and Maryland.

The Supreme Court's action Thursday followed federal court rulings this year in Ohio and Michigan striking down partisan gerrymanders and ordering new maps to be drawn. The justices temporarily blocked those requirements in May, pending their decisions in North Carolina and Maryland. Now the lower courts effectively have been overruled.

More:No new maps for Ohio till 2022 after U.S. Supreme Court gerrymandering decision

More:Conservative gains at Supreme Court leading to anger, frustration and 'peeks behind the curtain'

Last year, the justices let stand the Pennsylvania Supreme Court's decision striking down that state's congressional map and replacing it with one that helped Democrats win more seats in November. That was because the case was decided under the state constitution, rather than in federal court.

For the past decade, Democrats have been the bigger losers in gerrymandering fights. Republicans seized power in many states in the 2010 midterm elections, giving them control over the redistricting process. Democrats are at a disadvantage entering the 2020 elections, which will determine who draws the next decade's state and congressional lines in most states.

More:Supreme Court's Top Cases of 2019

Eight states, including California, use commissions to draw maps that are designed to treat both parties fairly. Voters in Colorado, Michigan and Utah chose that route last fall, while Missouri and Ohio voters approved other changes.

During oral argument in March, conservative justices noted that voters' initiatives might render the court's interference unnecessary. Roberts held out that lifeline to the challengers in his ruling Thursday.

"Our conclusion does not condone excessive partisan gerrymandering," he wrote. States can initiate changes, as some have, and Congress can intervene, as the Democratic-controlled House recommended by calling for independent commissions and nonpartisan redistricting criteria.

"We express no view on any of these pending proposals," Roberts said. "We simply note that the avenue for reform established by the Framers, and used by Congress in the past, remains open."

Contributing: Kristine Phillips