Several Republican voters who accused Maryland officials of redrawing a key congressional district to illegally favor Democrats won their federal lawsuit Wednesday, in a sharp rebuke of overt partisan gerrymandering that forces the state to fix the problem before the 2020 elections -- or have federal judges step in and come up with a new congressional map themselves.

The three-judge panel's decision, issued shortly after the midterm elections, orders the state to submit the new map by March 7. Otherwise, the court will appoint a commission to produce a redistricting plan for use in the 2020 congressional election.

The offending congressional district, one of eight in Maryland, was redrawn in 2011.

The panel hearing the case in U.S. District Court in Maryland said the state must redraw the 6th Congressional District's lines using "traditional criteria for redistricting," showing regard for "natural boundaries."

"Partisan gerrymandering is noxious, a cancer on our democracy," Chief District Judge James Bredar, appointed to the bench by President Barack Obama, wrote in a concurring opinion.

Earlier this year, President Trump made a similar argument when Republicans lost a Pennsylvania gerrymandering lawsuit, writing on Twitter that “Democrat judges have totally redrawn election lines in the great State of Pennsylvania. ... This is very unfair to Republicans and to our country as a whole."

"Partisan gerrymandering is noxious, a cancer on our democracy." — Chief District Judge James Bredar

The U.S. Supreme Court reviewed the Maryland case this summer before deciding in June to refer it back to the lower court for a decision, effectively allowing the 2011 map to remain in place for Tuesday's congressional elections.

The Supreme Court could take up the issue of partisan gerrymandering again this term, in a case from North Carolina. Republicans there have urged the justices to rule that courts should stay out of disputes about the political process.

Wednesday's decision, written by 4th U.S. Circuit Court Judge Paul Niemeyer, says the state's 2011 congressional map removed roughly 66,000 Republican voters from the 6th District and added around 24,000 Democratic voters, "bringing about the single greatest alteration of voter makeup in any district in the Nation following the 2010 census."

SUPREME COURT SIDES WITH TEXAS ON GERRYMANDERING DISPUTE

"To be sure, citizens have no constitutional right to be assigned to a district that is likely to elect a representative that shares their views. But they do have a right under the First Amendment not to have the value of their vote diminished because of the political views they have expressed through their party affiliation and voting history," Niemeyer wrote.

Critics have cited gerrymandering as the reason why Rep. John Delaney, a Democrat who is leaving the office to run for president, was able to defeat 10-term Republican Roscoe Bartlett in 2012, a year after the map was redrawn. Democrat David Trone won the seat on Tuesday, to maintain the 7-1 edge Democrats have in the state's congressional delegation.

Redistricting maps are drawn by the governor and approved by the state's General Assembly, which is currently controlled by Democrats.

Gov. Larry Hogan, a Republican, said the judges' decision confirms that Maryland has "the most gerrymandered districts in the country."

"This is a victory for the vast majority of Marylanders who want free and fair elections and the numerous advocates from across the political spectrum who have been fighting partisan gerrymandering in our state for decades," Hogan said in a statement.

A spokeswoman for Maryland Attorney General Brian Frosh's office, which has defended the state against the lawsuit, said in an email that the office is "reviewing options" after the judges' decision

Hogan has backed legislation designed to make congressional redistricting a nonpartisan process. Former Gov. Martin O'Malley, a Democrat, testified in a deposition for the federal lawsuit that he intended to "create a district where the people would be more likely to elect a Democrat than a Republican."

Kathay Feng, national redistricting director for the Common Cause advocacy group, said the court's ruling demonstrates Maryland's congressional map "squashed political participation and speech."

"Gerrymandering is an abuse of power no matter who does it, and both Democrats and Republicans use it for their political gain," she said in a statement.

The Associated Press contributed to this report.