Editor's note: This story has been updated throughout.

Some of Texas’ 36 congressional districts violate either the U.S. Constitution or the federal Voting Rights Act, a panel of federal judges ruled Friday.

In a long-delayed ruling, the judges invalidated the congressional map that Texas lawmakers drew in 2011.

In a 2-1 decision, the judges pointed to Congressional District 23, which stretches from San Antonio to El Paso, takes in most of the Texas-Mexico border and is represented by Republican Will Hurd of Helotes; Congressional District 27, represented by Blake Farenthold, R-Corpus Christi; and Congressional District 35, a Central Texas district represented by Lloyd Doggett, D-Austin.

The 166-page ruling by the San Antonio-based district judges was the latest in a complicated case that dates back to 2011, and comes just two election cycles away from the next U.S. Census — when the state would draw a new map under normal circumstances.

In 2013, the district court found evidence that lawmakers intentionally discriminated when redrawing the boundaries. But the U.S. Supreme Court soon complicated the case when it struck down a key section of the Voting Rights Act that had forced Texas to seek permission before making changes to election procedures.

But that didn’t end the legal battle. The U.S. Department of Justice and other plaintiffs pressed on in the case, and Texas held elections using interim maps drawn by judges.

In its decision Friday, the court still found that “mapdrawers acted with an impermissible intent to dilute minority voting strength or otherwise violated the Fourteenth Amendment” of the Constitution.

"The Court finds that this evidence persuasively demonstrates that mapdrawers intentionally packed [concentrated certain populations] and cracked [diluted certain populations] on the basis of race (using race as a proxy for voting behavior) with the intent to dilute minority voting strength," U.S. District Judges Orlando Garcia and Xavier Rodriguez wrote in the majority opinion.

In his dissenting opinion, Judge Jerry Smith of the U.S. Fifth Circuit Court of Appeals called the case moot under previous rulings, and he sharply criticized the Justice Department.

"The Department of Justice has overplayed its hand and, in the process, has lost credibility," Smith wrote. "The wound is self-inflicted. The grand theory on which its intervention was mainly based—that invidious racial motives infect and predominate in the drawing of the 2011 district lines—has crashed and burned. I respectfully dissent from the refusal to dismiss for want of jurisdiction."

The majority’s ruling loosened the case from a lengthy limbo; Groups suing the state complained the judges were dithering after hearing arguments in 2014.

Texas Democrats quickly rejoiced in the decision late Friday night.

“Tonight is a victory for the voting rights of all Texans," Gilberto Hinojosa, the state party chair, said in a statement.

Read more of our related coverage: