In a ruling that amounts to a green light for extreme partisan gerrymandering, Supreme Court Chief Justice John Roberts said in an opinion in two cases Thursday that the court has no role in policing the practice.

The court split on the issue 5-4 on conservative-liberal lines, with Justice Elena Kagan issuing a blistering dissent.

“Our conclusion does not condone excessive partisan gerrymandering. Nor does our conclusion condemn complaints about districting to echo into a void,” Roberts said in his opinion. “The States, for example, are actively addressing the issue on a number of fronts.”

The court had before it two partisan gerrymandering cases: Lamone v. Benisek challenging a map drawn by Democrats in Maryland and Rucho v. Common Cause challenging a GOP map in North Carolina.

In practice, the ruling is a devastating blow to voting rights advocates who hoped that the nation’s highest court would impose some limits on extreme gerrymanders to prevent the lawmakers who control how congressional and state legislative offices are drawn to create maps that benefit themselves.

The court’s decision means that court rulings that had reversed gerrymanders in Maryland, Michigan, North Carolina, Ohio and Wisconsin will all be overturned — a huge win for Republicans in every state except Maryland.

The court’s decision raises the stakes on the 2020 elections, where in many states voters will chose the lawmakers who will draw the maps for the next decade of redistricting.

Roberts himself admitted that extreme gerrymandering leads to “results that seem unjust,” but said that Congress and state-level independent redistricting commissions, not the courts, are responsible for avoiding these outcomes. In her dissent, Kagan countered that “the partisan gerrymanders here debased and dishonored our democracy, turning upside-down the core American idea that all governmental power derives from the people.”

“Advancements in computing technology,” Kagan continued, have enabled lawmakers to craft maps that benefit their party “with unprecedented efficiency and precision.”

The voting rights groups who brought the Maryland and North Carolina cases condemned the decision, but promised to continue fighting for fair maps.

“Today, five Supreme Court Justices turned their backs on hundreds of thousands of people in Maryland and North Carolina stripped of their voice in Washington by power-hungry politicians,” Common Cause President Karen Hobert Flynn said in a statement.

“Without recourse to the Supreme Court, the American people must continue to take the battle to the state courts, to the polls, and to the streets, to make their voices heard and to end partisan gerrymandering once and for all,” Flynn continued.

The Republican Party carried out a two-pronged plan in the 2010 election cycle, first working to sweep state-level races and obtain GOP control of statehouses across the country. In many states — most notably North Carolina, Michigan, and Wisconsin — they then drew maps that some lawmakers admitted were intended to create uncompetitive districts and lock in control for their party.

Particularly since the 2016 election, voting rights advocates and reform groups in states like Missouri and Michigan have successfully fought to provide citizens with more say in the redistricting process. Michigan voters passed a constitutional amendment to create an independent commission that controls how maps are drawn in the state.