AUSTIN, Texas—Federal judges found more problems in Texas’ voting rights laws, ruling that Republicans racially gerrymandered some congressional districts to weaken the growing electoral power of minorities, whom former President Barack Obama set out to protect at the ballot box before leaving office.

The ruling late Friday by a three-judge panel in San Antonio gave Democrats hope of new, more favorably drawn maps that could turn over more seats in Congress in 2018. But the judges in their 2-1 decision didn’t propose an immediate fix, and Texas could appeal to the U.S. Supreme Court.

Republicans hold two of three congressional districts that were ruled newly invalid and found to have been partly drawn with discriminatory intent. The GOP-controlled Texas Legislature approved the maps in 2011, the same year then-Gov. Rick Perry signed a voter ID law that ranks among the toughest in the U.S. Courts have since weakened that law, too.

Judges noted the “strong racial tension and heated debate about Latinos, Spanish-speaking people, undocumented immigrants and sanctuary cities” that served as the backdrop in the Legislature to Texas adopting the maps and the voter ID law. Those tensions are flaring again over President Donald Trump’s executive orders on immigration, and Republican Texas Gov. Greg Abbott is also demanding tough crackdowns on so-called sanctuary cities.

“The record indicates not just a hostility toward Democrat districts, but a hostility to minority districts, and a willingness to use race for partisan advantage,” U.S. District Judges Xavier Rodriguez and Orlando Garcia wrote in their opinion.