The Virginia House of Delegates’ racial gerrymander is officially dead—killed off by a 5–4 Supreme Court ruling on Monday that seems to clear the way for a potential Democratic sweep of the Virginia Legislature in November.

Although Monday’s decision in Virginia House of Delegates v. Bethune-Hill slays a gerrymander, it revolves around a more mundane issue: Who has the ability to defend that gerrymander in federal court? When Virginia voters first filed a lawsuit alleging that multiple House districts were drawn illegally along racial lines, the state attorney general defended the map. Eventually, a federal court found “overwhelming evidence” that the state had “sorted voters into districts based on the color of their skin,” violating “the guarantees of the Equal Protection Clause.” It appointed a special master to redraw 11 House districts and adopted his proposals, ordering the House to adopt his new map for the 2019 election.

Throughout these proceedings, Virginia Attorney General Mark Herring, a Democrat, defended the House’s unconstitutional districts. He did so because a Virginia law tasks the attorney general, and him alone, with the job of defending the state’s interests in court. After the federal court struck down the old map, Herring decided his job was done: He had defended the gerrymander since 2014, when the case began, and didn’t want to appeal the latest ruling to SCOTUS. But the House (and, specifically, its Republican speaker) had intervened in the case and did want to appeal. So it asked SCOTUS to reverse the district court and restore its old map.

On Monday, the Supreme Court held that the House lacked standing to appeal the ruling against its gerrymandered districts. Practically speaking, that means the 2019 election will take place under the new maps—a relief, since Virginia just held primary elections under these maps last week. Writing for the majority, Justice Ruth Bader Ginsburg first cited the Virginia statute giving the state attorney general (and not the House) the ability to “represent the state’s interests.”

The new map creates more diverse and competitive districts, handing Democrats a major victory.

Ginsburg then wrote that the new maps inflict no concrete injury on the House, depriving it of the right to appeal the district court’s decision. The court-imposed plan, she wrote, merely changes the House’s composition. But House districts already “change frequently”—after each census, at a minimum—and any ensuing electoral difficulties “are suffered by individual legislators or candidates, not by the House as a body.”

The House also claimed to be injured by the transferal of “redistricting authority from it to the District Court.” But under Virginia law, redistricting authority resides in the full General Assembly; the House and Senate must both vote to adopt any redistricting plan. Because the House “constitutes only a part” of the General Assembly, it does not have standing, on its own, to appeal the decision invalidating its districts. In other words, “a single House of a bicameral legislature lacks capacity to assert interests belonging to the legislature as a whole.”

Ginsburg’s opinion was joined by Justices Sonia Sotomayor, Elena Kagan, Clarence Thomas, and Neil Gorsuch. This scrambled ideological outcome isn’t too surprising; questions of standing have long fractured the court along unusual lines. Justice Samuel Alito dissented, writing that the House map has “an important impact on the overall work of the body”; a change to the map therefore has a “powerful effect” on the chamber’s ability to do its job. This effect, he argued, amounts of an injury that should give the House standing to appeal.

All 11 districts invalidated by Monday’s decision were flagrantly gerrymandered to capture minority communities, trapping a huge number of black voters in a few non-competitive districts. The new map creates more diverse and competitive districts, handing Democrats a major victory. Right now, Republicans hold a 51–49 majority in the House; under the new, fairer map, Democrats seem likely to seize the chamber in November. They’re also favored to take the Senate—and since the state has a progressive (if disgraced) governor, a legislative sweep would create a Democratic trifecta. That would give Virginia Democrats control over the 2020 redistricting process, preventing Republicans from drawing another round of gerrymanders to last another decade.