Michigan Republicans gerrymandered nearly three dozen congressional and state legislative districts so severely that they violated the U.S. Constitution, a three-judge panel ruled on Thursday.

The panel blocked the state from using the current maps in future elections and gave lawmakers until Aug. 1 to enact a new plan.

The panel was focused on 34 districts, a combination of congressional, state House and state Senate lines, which were ― challenged by the League of Women Voters, the plaintiffs in the case. The panel found the way all 34 districts were drawn violated the First Amendment. Twenty-seven of the 34 districts violated the 14th Amendment, the court ruled.

The court blocked the state’s 1st, 4th, 5th, 7th, 8th, 9th, 10th, 11th and 12th congressional districts. Fifteen state House districts and 10 state Senate districts were also blocked. The panel also ordered special elections in the 10 state Senate districts in 2020 as well as any Senate district affected by the redrawn map.

The U.S. Supreme Court is set to rule by June on whether gerrymandering that severely benefits one party over the other is unconstitutional. The final outcome of the Michigan case will likely hinge on what the Supreme Court decides.

Michigan Republicans controlled the state Legislature in 2011 and drew electoral boundaries to give their party an advantage in both the congressional delegation and the state House. Republicans maintained that advantage even though the state is competitive with Democrats. Last year, voters in the state approved a constitutional amendment stripping lawmakers of their redistricting power and giving it to an independent redistricting commission.

“We find that the Enacted Plan violates Plaintiffs’ First and Fourteenth Amendment rights because it deliberately dilutes the power of their votes by placing them in districts that were intentionally drawn to ensure a particular partisan outcome in each district,” the panel wrote in a unanimous opinion. “The Enacted Plan also injures Plaintiffs’ First Amendment right to association by discriminating against them and their political party and subjecting them to ‘disfavored treatment by reason of their views.’”

In March, the Supreme Court appeared divided on whether partisan gerrymandering could survive constitutional scrutiny. The justices struggled with whether there was a way they could figure out if there was some kind of standard they could use to determine when partisan gerrymandering was constitutional. Justice Neil Gorsuch questioned whether it was even appropriate for the courts to weigh in on the issue. He pointed to anti-gerrymandering ballot measures in Michigan and other states as evidence that it was possible to fix the problem without the courts getting involved.

But the three-judge panel in the Michigan case seemed to be writing directly to the Supreme Court and asking them to do something about partisan gerrymandering.

“Partisan gerrymandering ‘enables politicians to entrench themselves in power against the people’s will. And only the courts can do anything to remedy the problem, because gerrymanders benefit those who control the political branches,’” the panel wrote, quoting a concurring opinion from Justice Elena Kagan.

“Federal courts must not abdicate their responsibility to protect American voters from this unconstitutional and pernicious practice that undermines our democracy,” it continued. “Federal courts’ failure to protect marginalized voters’ constitutional rights will only increase the citizenry’s growing disenchantment with, and disillusionment in, our democracy, further weaken our democratic institutions, and threaten the credibility of the judicial branch.”

Michigan Gov. Gretchen Whitmer (D) said in a statement she was urging the parties involved not to appeal the decision.

“The court reached a unanimous decision, which found clear evidence of partisan gerrymandering in the state of Michigan. These unfair maps weaken our democracy, which is why the governor is urging all parties involved in this case to allow this ruling to stand so we can get to work drawing fair maps prior to the 2020 election,” she said.

This story has been updated with additional details from the ruling and a statement from Whitmer.