A federal three-judge panel in San Antonio invalidated three Texas congressional districts for violating the Voting Rights Act or the Constitution in a decision late Friday night.

The districts, drawn by the Texas legislature in 2011, are GOP Rep. Will Hurd’s 23rd District, GOP Rep. Blake Farenthold’s 27th District and Democratic Rep. Lloyd Doggett’s 35th District.

In Hurd’s district, which has been one of the most competitive districts around the country, the court ruled that the legislature drew the lines with “the intent and effect of diluting Latino voter opportunity.” Hurd’s district spans much of Texas’ border with Mexico.

As for Doggett’s district, the court said the legislature used race to draw the lines, packing Democrats into the district and thereby diluting their voting power elsewhere. The court also ruled that the legislature pushed Hispanics into the district in an effort to defeat Doggett if a Hispanic candidate challenged him.

“The political motive does not excuse or negate that use of race; rather, the use of race is ultimately problematic for precisely that reason — because of their political motive, they intentionally drew a district based on race in a location where such use of race was not justified by a compelling state interest,” the court ruled.