Slate's Who Counts? series is made possible by the support of Slate Plus members and readers like you.

In November 2017, a blue wave crashed down upon Virginia, as Democrats won the statewide vote by nearly 10 points. They failed, however, to seize control of the House of Delegates, which came down to a single tied race that was resolved by the elections board drawing the Republican’s name from a bowl and declaring him the winner.

On Tuesday, that Republican lost his seat, one of six that Democrats flipped to capture a majority the House of Delegates. Democratic candidates appear to have won the overall House vote once again–but this time, they gained a 55–45 majority. (They also won over the state Senate, 21–19, which holds elections every four years.) This turn of fortune reveals the impact of fair maps. In 2017, Democrats were severely disadvantaged by a Republican-drawn racial gerrymander that trapped a huge number of black voters in a handful of noncompetitive districts for nearly a decade. By 2019, that gerrymander was dead, killed off by the courts. And its demise has allowed Virginia Democrats to translate their votes into fair representation in the General Assembly, gaining full control of the state government for the first time since 1994.

Virginia’s gerrymander had its roots in the 2009 election. Republicans swept the state that year, winning both chambers of the Legislature as well as the governorship. (The election presaged the GOP conquest of state legislatures in time for the next redistricting cycle, masterminded by Virginia’s Ed Gillespie.) After the 2010 census, the GOP-controlled General Assembly passed—and Gov. Bob McDonnell approved—maps that divvied up the state on the basis of race. Most minority voters were packed into heavily black Democratic districts; the rest were scattered through predominantly white Republican districts. The House map was the worse of the two, blatantly relying upon “blue sinks” to siphon off votes from districts that might otherwise have proved competitive.

In 2014, Virginia voters filed a lawsuit alleging that 12 House districts had been drawn along racial lines, in violation of the equal protection clause. Four years later, a federal district court invalidated 11 of the 12 districts, agreeing that they amounted to an unconstitutional racial gerrymander. The court appointed a special master to redraw the illegal districts. But, of course, fixing a handful of districts creates a ripple effect that requires more lines to be redrawn to maintain equal population. The court wound up adopting a remedial map that altered 25 districts, eliminating several safe GOP seats and generating more competitive races. Attorney General Mark Herring declined to appeal the decision, leaving the House to step in—but in June, the Supreme Court ruled that the House lacked standing to represent the state. The new maps won out.

The problem was illicit redistricting.

Democrats took full advantage of the level playing field, raking in buckets of cash to finance aggressive campaigns against Republican incumbents. They flipped several key districts that were redrawn this year to clinch their House majority. Democrats also exploited the GOP’s gerrymander rot: Suburban districts have swung left under Donald Trump, leaving Virginia Republicans scrambling to dissociate themselves with the president. These developments translated into a resounding victory for progressives.

There is very little doubt that Democrats would’ve taken control of the Virginia House in 2017 if Republicans’ racial gerrymander had fallen in time. Tuesday’s blowout demonstrates that there’s no mysterious or insurmountable hurdle that organically prevents Democrats from translating a landslide (in overall votes) into a majority in the General Assembly. The problem was not that Democratic voters tend to cluster in urban regions, as some Republicans have long claimed. The problem was illicit redistricting.

Now the chief question facing Virginia Democrats is whether they will engage in tit-for-tat gerrymandering after the 2020 census, capitalizing upon their power to entrench Republicans in the minority. (While racial gerrymandering is forbidden, the Supreme Court has declined to prohibit partisan gerrymandering.) In February, the Legislature passed a constitutional amendment that would create a bipartisan commission to draw district lines in the future. But the measure will not take effect unless the incoming Legislature passes it once more and voters approve it. Democratic legislators will soon need to decide if they want to entrench their majority through undemocratic means—or enact reforms that take politics out of Virginia redistricting for good.