AUSTIN, Texas (Reuters) - A U.S. court struck down two Republican-drawn U.S. congressional districts in Texas on Tuesday, saying they were discriminatory and ordering a remedy ahead of elections in 2018, court papers showed.

In the case that has been contested in federal courts for about six years, a three-judge panel at U.S. District Court in San Antonio ruled lawmakers drew up the districts to undermine the influence of racial minority voters, who plaintiffs argued typically show more support for Democrats than Republicans.

The court also said that the maps laying them out must either be fixed by the state or the courts.

The court said the 27th and 35th congressional districts were drawn in violation of the U.S. Voting Rights Act. Texas has 36 districts, with Republicans holding 25 seats in the U.S. House of Representatives and Democrats 11.

The court also faulted the state’s legislature for not heeding previous judicial plans and for making inadequate fixes to the maps drawn in 2011.

“The discriminatory taint was not removed by the Legislature’s enactment of the Court’s interim plans,” the judges said in their decision.

Texas Democrats saw the decision as a victory.

“Republicans initiated a deceitful legal strategy to deliberately silence Texans from having a voice in their own government. Today, the Court unanimously agreed,” Texas Democratic Party Chair Gilberto Hinojosa said in a statement.

Republican Texas Attorney General Ken Paxton said the court did rule in Texas’ favor in finding that one contested district, District 23, was lawful.

However, Paxton said in a statement the state has been abiding by the law and prior court guidance and he intended to ask the U.S. Supreme Court whether Texas “had discriminatory intent when relying on the district court.”

In court, lawyers for Texas argued that the boundaries were drawn for Republican partisan advantage, which they said is legal. They dismissed claims the districts were drawn illegally with the intention to disenfranchise racial and ethnic groups.