WASHINGTON (AP) — A divided Supreme Court kept Texas’ voting maps largely intact Monday, dealing an election-year blow to Democrats by reversing earlier findings that intentional racial discrimination continues to stain several statehouse and congressional districts.

The 5-4 decision comes nine months after Democrats had celebrated lower court rulings that invalidated parts of Texas’ electoral maps and a revised voter ID law. But the voter ID law was also restored in April, and Texas Republicans now have another key victory in long-running battles over voting rights in a state with a booming Hispanic population.

“Our legislative maps are legal. Democrats lost their redistricting & Voter ID claims,” Republican Texas Gov. Greg Abbott tweeted.

The decision also dampened Democrats’ case that Texas should once again need federal approval before changing voting laws, a requirement the Supreme Court eliminated in 2013 when it gutted the heart of the federal Voting Rights Act.

In August, a federal court in San Antonio agreed with Democrats and voting rights groups that current electoral districts in Texas were tainted by earlier and intentionally discriminatory map lines first approved by the GOP-controlled Legislature in 2011.

But Justice Samuel Alito said for the court’s conservative majority that the lower court made a mistake by striking down two congressional and seven state house districts. The high court struck down one safe Democratic House district in Fort Worth because the state relied too heavily on race when it increased the district’s Latino population.

“We now hold that the three-judge court committed a fundamental legal error,” Alito wrote. The lower court ignored evidence showing that the legislature adopted districting plans in 2013 primarily to try to end the litigation over the districts, Alito said.

The court’s liberal justices dissented.

“The court today does great damage to that right of equal opportunity,” Justice Sonia Sotomayor wrote. She said her colleagues had blinded themselves “to the overwhelming factual record below. It does all of this to allow Texas to use electoral maps that, in design and effect, burden the rights of minority voters.”

Democrats are outnumbered nearly 2-1 in the Texas Legislature and have long contended that unfair maps have accelerated that imbalance. In 2009, Republicans had only a slim two-seat majority in the Texas House.

“The rules were changed today,” said Democratic state Rep. Rafael Anchia, chairman of the Mexican American Legislative Caucus.

Texas’ congressional and legislative districting plans have been embroiled in court action for years, beginning in 2011.

After the state’s original maps were tossed out as probably unconstitutional, a three-judge federal court produced interim districting plans that were used in the 2012 elections.

In 2013, Republicans who control the state government rushed to permanently adopt those maps to use for the rest of the decade, until a new round of redistricting after the 2020 census. But opponents criticized the adopted maps as a quick fix that didn’t purge all districts of the impermissible use of race.

“This is a huge win for the Constitution, Texas, and the democratic process. Once again, Texans have the power to govern themselves,” Republican Texas Attorney General Ken Paxton said.

___

Weber reported from Austin, Texas.