LATER this year the Supreme Court will hear a new spin on a scourge almost as old as the republic: partisan gerrymandering, a trick whereby politicians pick their voters rather than the other way around. In recent years, the justices have cracked down on districts that are drawn using predominantly racial lines. A ruling in 2015 held that Alabama violated the 14th amendment’s equal-protection guarantee by packing too many black voters into state senate districts and diluting their influence in neighbouring areas. Last month, in Cooper v Harris, the court reprimanded North Carolina for doing the same in two bizarrely shaped legislative districts. But the justices have looked the other way when oddly drawn districts clump voters based on party rather than race. Partisan gerrymandering may be “unsavoury”, as Justice Samuel Alito puts it, but has not been held to offend the constitution.

Gill v Whitford, one of the most important cases the justices will hear next term, calls Justice Alito’s statement into question. The timing is key. With the 2020 census and campaigns around the corner, new electoral maps will soon be on the draftsman’s table. If the challenge to hyper-partisan line-drawing succeeds, the shape of districts to come may tighten the link between voters’ preferences and who gets elected.

America has strayed further from this ideal in recent years, mainly to the detriment of Democrats. After an electoral surge in 2010, Republicans used their newfound control of state legislatures and governor’s mansions to transform the way Americans vote. The results were staggering. In races for the House of Representatives in 2012, 1.3m more voters opted for Democrats than Republicans—but it was the Republicans who wound up with a 234-201 majority. Two years later, Republicans won a slim majority of all votes in House races (52%), but they nabbed 57% of House seats. The phenomenon was even more pronounced in some state races. In Wisconsin, 51% of voters in 2012 picked Democrats in state legislative contests, but Republicans grabbed 60 of the 99 assembly seats. They expanded their hold to 64 seats in 2016.

The plaintiffs in Gill say these skewed outcomes stem from “pinpoint-precision technology that sliced-and-diced American communities”. REDMAP, as the Republican redistricting programme was dubbed, wasn’t shy about its goals (“maintain[ing] a Republican stronghold in the US House of Representatives for the next decade”) or its methods (“controlling the redistricting process”). And until now, this strategy has been constitutionally kosher. In 1986, the Supreme Court turned back a challenge to partisan line-drawing, holding that Indiana Democrats had not shown that their plight at the hands of gerrymandering Republicans was “sufficiently adverse” to the equal-protection guarantee. Eighteen years later, four justices insisted it was impossible to determine when politically motivated district-drawing crossed a constitutional line, while the four liberal justices each floated a standard for doing just that. The decisive vote came from Justice Anthony Kennedy, to this day the court’s centre of gravity, who rejected each of the liberals’ proposals but refused to give up hope that one day, in another case, a defensible line might be found.

With octogenarian Justice Kennedy rumoured to be considering retirement, Gill may be, as election-law expert Rick Hasen says, the Supreme Court’s “last best chance” of draining the redistricting process of excess partisanship. The novel approach is tuned to Justice Kennedy, whose 2004 opinion lamented that legislators were “in the business of rigging elections”.

Eric McGhee, a political scientist, and Nicholas Stephanopoulos, a law professor, think they have exactly what the justice ordered: a metric for measuring the extent of the partisan imbalance. Here is how it works: in all elections, the losing candidate gets some votes and the winning candidate gets more votes than he needs to win; these are all so-called “wasted votes”. Messrs McGhee and Stephanopolous subtract one party’s wasted votes from the other’s, and then divides that difference by the total number of votes cast. This yields the “efficiency gap”. If it’s large enough (7% or higher, the scholars say), one party can be said to hold an unconstitutional “systematic advantage” over the other, stifling democracy and ensuring the majority repeat victories until the next round of maps is drawn. Republicans’ efficiency gap in Wisconsin has been as high as 13%.

When a federal district court in Wisconsin struck down the state’s district map in 2016, it decided the case based on different reasoning but said the efficiency-gap model corroborated their findings. Will Justice Kennedy bite in Gill? In an early possible sign to the contrary, he joined the four conservative justices on June 18th in putting the lower court’s ruling on hold pending the Supreme Court’s ultimate decision. But Justice Kennedy’s 2004 opinion inspires another view. If “workable standards” for unrigging elections were to surface, he wrote, “courts should be prepared to order relief”.