WASHINGTON — The U.S. Supreme Court on Monday tossed out a lawsuit in Virginia over political boundaries for its state Legislature.

By a 5-4 vote — but not strictly along the usual conservative/liberal divide — the court said Virginia's House of Delegates did not have the legal right to carry on a fight over the map once state officials bowed out.

The dispute arose after the last census when the Republican-controlled Legislature redrew the district lines for the Virginia Senate and the House of Delegates. In response to a lawsuit, a federal court declared the map invalid, concluding that it unconstitutionally sorted voters based on race. A redrawn map was seen as more favorable to Democrats.

Virginia's attorney general declined to appeal, and the House of Delegates picked up the fight. But the Supreme Court said a single house of the Legislature had no authority to do so.

"The House observes that Virginia gives redistricting authority to the 'General Assembly.' True enough," Justice Ruth Bader Ginsburg wrote. But, she said, "One house of its bicameral legislature cannot alone continue the litigation against the will of its partners in the legislative process."

She was joined by two of the court's other liberals, Sonia Sotomayor and Elena Kagan, but also by two of the court's most conservative members, Clarence Thomas and Neil Gorsuch.

Virginia Attorney General Mark Herring called the ruling a big win for democracy.

"It's unfortunate that House Republicans wasted millions of taxpayer dollars and months of litigation in a futile effort to protect racially gerrymandered districts, but the good news is that this fall's elections will take place in constitutionally drawn districts," Herring said.

Eric Holder, the former U.S. attorney general during the Obama administration, called the decision "an important victory for African Americans in Virginia who have been forced since 2011 to vote in racially gerrymandered districts that unfairly diluted their voting power."

"With a new, fair map in place, all Virginians will now — finally — have the opportunity this fall to elect a House of Delegates that actually represents the will of the people," Holder said.

Monday's decision will have no practical effect, because the Supreme Court had earlier allowed elections to proceed using the redrawn map that the House of Delegates opposed.