WASHINGTON (Reuters) - The U.S. Supreme Court on Monday handed Republican legislators in Virginia a defeat, leaving in place a ruling that invalidated state electoral districts they drew because they weakened the clout of black voters in violation of the U.S. Constitution.

FILE PHOTO: Demonstrators protest during a Fair Maps rally outside the U.S. Supreme Court, in Washington, U.S., March 26, 2019. REUTERS/Brendan McDermid/File Photo

The justices, in a 5-4 decision, sidestepped a ruling on the merits of the case. They instead found that the Republican-led state House of Delegates lacked the necessary legal standing to appeal a lower court ruling that had invalidated 11 state House districts for racial discrimination.

Virginia Attorney General Mark Herring, a Democrat and the state’s top law enforcement official, opposed the appeal and argued that the Republican legislators were not entitled to act on behalf of the state in the case. A new political map is being used for this year’s state elections.

“Virginia’s elections this fall will take place in fair, constitutional districts. It’s a good day for democracy in Virginia,” Herring wrote on Twitter.

The Supreme Court’s action let stand a 2018 ruling by a federal three-judge panel that the 11 districts all violated the rights of black voters to equal protection under the law under the U.S. Constitution’s 14th Amendment.

The state’s Republican-led House of Delegates “lacks authority to displace Virginia’s attorney general as representative of the state,” Justice Ruth Bader Ginsburg wrote for the court’s majority.

“In short, Virginia would rather stop than fight on. One house of its bicameral legislature cannot alone continue the litigation against the will of its partners in the legislative process,” Ginsburg added.

The court was not split on ideological lines, with Ginsburg joined in the majority by fellow liberal justices Elena Kagan and Sonia Sotomayor as well as two conservative justices, Clarence Thomas and Neil Gorsuch.

The case involved a hot topic for the Supreme Court: a practice called gerrymandering involving the manipulation of electoral district boundaries to marginalize a certain set of voters and increase the influence of others. In this case, the Republican legislators were accused of racial gerrymandering to disadvantage black voters.

In two other major cases from Maryland and North Carolina, the justices are considering whether courts can curb gerrymandering aimed at purely partisan advantage. They are due to rule in those cases by the end of this month.

At issue in the Virginia case was the state legislative map drawn by Republicans after the 2010 national census.

‘SEEDS CONFUSION’

The National Republican Redistricting Trust, a group that backs Republican efforts to redraw electoral districts, criticized the ruling.

“It seeds confusion into a volatile, evolving body of law that demands clarity just as the next redistricting cycle begins,” said Adam Kincaid, the group’s executive director.

New electoral maps will be drawn nationwide following the 2020 census.

Since the Virginia maps that were challenged in the case were drawn, Democrats have made gains in Virginia in both state and federal elections. The current governor, Ralph Northam, and Herring, both are Democrats. Northam has been involved in a racial controversy of his own this year after a racist photo from his 1984 medical school yearbook page surfaced.

“This is a welcome ruling from the Supreme Court - it’s like I’ve always said, voters should choose their representatives, not the other way around,” Northam said on Twitter.

Like other U.S. southern states, Virginia has a complicated racial history dating back to the era of slavery.

The voters who brought the legal challenge accused Republicans of packing black voters into certain state House districts to diminish their voting power and make surrounding districts more white and more likely to support Republicans.

Democrats have accused President Donald Trump’s fellow Republicans in Virginia and other states of crafting such legislative maps in a way that crams black and other minority voters, who tend to favor Democratic candidates, into certain districts in order to reduce their overall sway in the state.