WINSTON-SALEM, N.C. (Reuters) - A three-judge federal panel ordered congressional districts in North Carolina to be redrawn ahead of the 2018 elections, ruling on Tuesday that the Republican-drawn map was illegal and unconstitutionally partisan.

The ruling was the first time that a federal court blocked a congressional map because of partisan gerrymandering, said Michael Li, a redistricting expert at New York University’s Brennan Center for Justice.

The judges in a 191-page ruling said the state legislator responsible for the 2016 map had said he drew it to give Republican candidates an advantage.

“But that is not a choice the Constitution allows legislative map drawers to make,” the court said.

The panel gave the state until Jan. 29 to file a proposed remedial plan with the court. Congressional elections are scheduled for November across the United States.

Ralph Hise, North Carolina’s state Senate Redistricting Chairman, said through a spokeswoman that lawmakers would appeal.

Dallas Woodhouse, the state’s Republican Party Executive Director, said in a statement that the ruling usurped legislative authority and amounted to “partisan war on North Carolina Republican voters.”

Democrats and the groups that brought the lawsuit applauded.

“Today’s ruling is a major victory for North Carolina and people across the state whose voices were silenced by Republicans’ unconstitutional attempts to rig the system to their partisan advantage,” North Carolina Democratic Party Chairman Wayne Goodwin said in a statement.

NYU’s Li said that if the North Carolina case is upheld upon appeal it would have far-reaching implications.

“The courts will have signaled that there are, in fact, limits of how far you can go with partisan gerrymandering,” Li said.

The U.S. Supreme Court is expected to rule later this year on Wisconsin’s appeal of a lower court ruling that state Republican lawmakers created unconstitutional state legislative districts with the partisan aim of hobbling Democrats in legislative races.

The Supreme Court has been willing to invalidate state electoral maps on the grounds of racial discrimination, as it did last May when it found that Republican legislators in North Carolina had drawn two electoral districts to diminish the statewide political clout of black voters. But the justices have not thrown out state electoral maps drawn simply to give one party an advantage over another.

Republicans in North Carolina could decide to seek a stay of the ruling until the Supreme Court decides the Wisconsin case, said Virginia Tech political scientist Nicholas Goedert.