Supreme Court on Monday sided with voters who challenged Virginia’s state legislative map, who alleged that some of the districts drawn were a racial gerrymander.

The 5-4 decision came down to a narrow procedural issue, with the majority finding the Republicans lawmakers who were still defending the challenged map did not have the standing to appeal the case, after the state defendants had opted not to appeal the lower court decision striking down the map. While the court’s split did not come down to the usual liberal-vs.-conservative coalitions, Monday’s decision is a major win for Virginia Democrats, who will go into the state’s 2019 elections with a much more favorable map than the one in 2017 where they failed to take over the state’s legislature by the narrowest of margins.

Justice Ruth Bader Ginsburg wrote the majority’s opinion, where she was joined by Justices Clarence Thomas, Elena Kagan, Sonia Sotomayor, and Neil Gorsuch.

“One House of its bicameral legislature cannot alone continue the litigation against the will of its partners in the legislative process,” Ginsburg wrote, referring the state’s House of Delegates.

Justice Samuel Alito wrote a dissent joined by Chief Justice John Roberts, Justice Stephen Breyer, and Justice Brett Kavanaugh.

The decision comes after Virginia held its primaries last week using the new maps drawn to replace the 2011 map that was deemed illegal. The Supreme Court earlier this year declined to halt a lower court from ordering the replacement of the challenged map while the justices were considering the case.

Republicans had fought tooth and nail against redrawing the map, which could determine which party controls the legislature going into the next round of redistricting after the 2020 census.

The case’s oral arguments in front of the justices in March marked the lawsuit’s second time in front of the Supreme Court.

The map was originally challenged in 2014 by voters who alleged that African American voters were illegally packed in 12 districts, diluting their votes. Those districts had been drawn with the aim of each meeting a standard of 55 percent of the population being African American.

After initially losing at the lower court level, the challengers appealed it to the Supreme Court, which in 2017 sent the case back down to the lower court to assess 11 of the 12 districts under a different legal standard than it previously had.

When it did, the lower court ruled in favor of the challengers, prompting the GOP-controlled House of Delegates, which were among the parties defending the map, to appeal to the Supreme Court. While it was being appealed, the trial court ordered and oversaw the drawing of a replacement map.

The high court had it in front of it two questions: whether it was appropriate for the House of Delegates to take the case back up to the Supreme Court, given that state officials — who at one point were also defendants — opted not to appeal it the Supreme Court the second time around. Because the Supreme Court concluded on Monday that the House of Delegates did not the proper standing in bringing the case to the justices, it did not decide the second question on the merits of the lower court’s racial gerrymandering finding.

The Republican House of Delegates have argued that they used the 55 percent quota to keep the map in compliance of the Voting Rights Act, which mandates that minority voters have the opportunity to elect the candidates of their choice.

The Supreme Court on Monday avoided deciding the merits of that argument.

But in handing down a decision that allowed the replacement map to stand, the justices have likely tilted the 2019 elections in Democrats’ favor.

According to one analysis of the new map, six House of Delegates districts held by Republicans could be shifted towards Democrats. Republicans currently hold a 51-96 majority in the chamber.