(Reuters) - A panel of three federal judges on Friday ruled that Ohio’s Republican-drawn congressional map is an unconstitutional partisan gerrymander and ordered the state to revamp it before the 2020 presidential election.

FILE PHOTO: Voters cast their votes during the U.S. presidential election in Elyria, Ohio, U.S. November 8, 2016. REUTERS/Aaron Josefczyk/File Photo

The ruling comes a week after another federal court ruled that Michigan’s congressional maps were unconstitutionally drawn by Republican politicians to dilute the power of Democratic voters.

Both Michigan and Ohio are expected to play a pivotal role in the 2020 election, as they have in recent elections. They were key swing states in Republican U.S. President Donald Trump’s 2016 electoral victory.

“We are convinced by the evidence that this partisan gerrymander was intentional and effective and that no legitimate justification accounts for its extremity,” the U.S. District Court in Cincinnati panel wrote in its decision, ordering the state to create a plan to fix the map by June 14.

The ruling in Ohio could be short-lived if the U.S. Supreme Court rules in June that partisan gerrymandering cases cannot be brought in federal court.

In partisan gerrymandering, one political party draws legislative districts to weaken the other party’s voters. The lines are typically redrawn once a decade after the U.S. census, and in many states the party in power controls the decision-making.

Republicans control both houses of the Ohio legislature, as well as the governorship.

Four congressional elections have occurred under the map and each resulted in 12 Republican representatives and four Democratic representatives, the ruling noted.

Included in the 2012 map was the “‘Snake on the Lake’ — a bizarre, elongated sliver of a district that severed numerous counties,” the judges wrote in their 301-page opinion, referring to the state’s 9th district that runs along Lake Erie.

Ohio Attorney General Dave Yost, a Republican, said in a statement that the state will seek a stay and appeal.

The court said it will redraw the maps itself if Ohio fails to come up with a solution that the judges deem fair.

The ruling comes in a lawsuit brought last year by the League of Women Voters and the American Civil Liberties Union against the state’s attorney general.

“This opinion, declaring Ohio an egregiously gerrymandered state, completely validates every one of our claims and theories in every respect,” Freda Levenson, legal director for the ACLU of Ohio, said in a statement.

Ohio’s secretary of state, Frank Larose, a Republican who oversees the state’s elections process, said his office will work to “administer fair, accurate and secure elections in 2020, pending the conclusion of the judicial process,” he said.

The conservative justices who hold a 5-4 majority on the U.S. Supreme Court at a March hearing focused on gerrymandering in Maryland and North Carolina signaled that they were skeptical of lower courts’ authority to block electoral maps drawn to give one party a lopsided advantage.

Critics have said gerrymandering has become increasingly effective and insidious, guided by precise voter data and powerful computer software.