VIRGINIA’S HOUSE OF DELEGATES has been under Republican control since 2000. But Democrats could take it back this November thanks in part to the musings of an academic in California.

Last year, a three-judge panel selected Bernard Grofman, a professor of political science at the University of California, Irvine, as a “special master” to advise them on the complexities of resetting Virginia House districts that they had declared to be in violation of federal voting-rights protections. The boundaries, drawn up in 2011, had had reduced Democrats in the House of Delegates to a puny minority. On February 14th the panel, made up of two district court judges and one appellate judge, ordered the state to adopt a combination of the maps Mr Grofman had put forward in a 131-page report bristling with electoral and demographic arcana.

For Democrats, there is some poetic justice in Mr Grofman’s plan. The federal judges had said that Republicans deliberately crammed African-American voters into 11 districts between Richmond and Norfolk—from the centre of the state to its coastal corner—to eliminate them as threat to white Republican incumbents in surrounding, increasingly suburban areas. Tweaking more than two dozen districts, Mr Grofman proposed boundaries that could, in November, imperil two Republicans who were partly responsible for the old map: the House speaker, M. Kirkland Cox, and S. Chris Jones, the chairman of the budget-writing Appropriations Committee.

Democrats need only two seats in the House and two in the Virginia Senate, which also will be decided in November, to take back the legislature and give the party complete control of state government for the first time since 1993. Mr Grofman’s map could line up six Republican-held House seats for Democrats, who hope that distaste for President Donald Trump will offset the scandals enveloping their governor, lieutenant-governor and attorney-general.

Under Mr Grofman’s plan, the presumed Democratic vote in Mr Cox’s district would swell by more than 32 percentage points and in Mr Jones’ district by 27 percentage points. But their defeats are not certain. Mr Cox and Mr Jones are seasoned politicians—well-financed, constituent-friendly and mindful of shifting voter tastes in a state that over the past decade has become strongly Democratic. Unnerved by the Democratic landslide that nearly cost Republicans their House majority in 2017, last year they worked with the new governor, Ralph Northam, to bring Virginia fully under the Affordable Care Act, also known as Obamacare. They had opposed it during the administration of Terry McAuliffe, Mr Northam’s predecessor and a fellow Democrat. Mr McAuliffe’s own quarrel with Republicans over congressional redistricting was settled by a court decree in which Mr Grofman also had a central role.

Then, Democrats had alleged that the African-American population of the state’s only majority-black congressional district had been intentionally inflated by Republicans to shield a potentially vulnerable white Republican incumbent in a district south of Richmond. The court sided with Democrats, as did the Supreme Court when Republicans appealed. Because of a parliamentary stand-off between Mr McAuliffe and the legislature, Republicans were denied a chance to redraw the offending district. That tossed the matter in 2015 to the trial court, which turned to Mr Grofman for guidance.

He came up with plan that created two congressional districts with large numbers of African-Americans. In 2016 that helped bring about the re-election of the state’s first black congressman since the 1890s, Bobby Scott, now chairman of the House Education and Labour Committee, and the election of a second African-American, Donald McEachin.

When the judges voted to accept Mr Grofman’s new plan Republicans were left with only one option for avoiding its potentially perilous consequences: an appeal to the Supreme Court. America’s highest court will hear oral arguments in the case on March 18th. In two earlier appeals against redistricting decisions in Virginia, the Supreme Court has disappointed Republicans. It may do so again.