A much-anticipated U.S. Supreme Court showdown soon will decide whether America’s major political parties can continue to rig American elections without violating the Constitution.

The case of Whitford vs. Gill will test the court’s willingness to finally set constitutional limits on that long-standing, pervasive form of election rigging known as partisan gerrymandering.

Taking center stage in Whitford, and playing a pivotal role, will be the innovative idea of a San Francisco political scientist.

Eric McGhee’s “efficiency gap” model may prove to be the elusive standard the court has been seeking to enable the justices to identify and rein in excessively partisan gerrymanders.

Partisan gerrymanders rig elections by manipulating the borders of voting districts to favor one political party over another. They deliver majorities, even supermajorities, of a party’s candidates to the legislature, in defiance of the majority of voters overall.

They create “safe seats” that insulate incumbents, making them less accountable, less willing to compromise and more likely to contribute to legislative gridlock.

They let politicians select the voters they need rather than allowing voters to elect the leaders they want.

And they are unconstitutional, at least theoretically.

The Supreme Court has said that partisan gerrymanders violate the Constitution when they’re excessive. But the court has felt ill-equipped to define when a gerrymander has crossed into “excessive” territory and over the constitutional line.

The justices have searched in vain for an effective, manageable standard on which they credibly can rely to evaluate partisan bias in voter-district plans.

In the absence of such a standard, the courts consistently have given a constitutional pass to partisan gerrymanders, even avowedly excessive ones.

That finally changed in November with Whitford, when a federal district court ruled, for the first time, that a partisan gerrymander was unconstitutionally excessive.

In doing so, the court relied on McGhee’s “efficiency gap” model to reject an extremely aggressive districting plan mapped by the Republican-controlled Wisconsin Legislature.

McGhee, a research fellow at the Public Policy Institute of California, was studying partisan bias in California’s elections when he hit upon the idea of seeing bias as a function of “wasted” votes.

Votes are “wasted” when they are cast for losing candidates, or for winning candidates beyond what was needed to win (the “over-vote”).

McGhee’s insight was to see discriminatory bias in the way a gerrymander makes the opposing party “waste” as many votes as possible.

His model offers an intuitive way to gauge the effects of gerrymandering’s time-honored map-drawing techniques, quaintly known as “packing” and “cracking.”

“Packing” involves designing voter plans that crowd opposition voters into districts that are already opposition strongholds. The opposition’s “wasted” over-vote is thus maximized when such districts are “packed” to the max.

“Cracking” involves drawing plans that break up opposition strongholds and relegate the divided remnants to surrounding districts where they are reliably outnumbered. This increases the number of districts the opposition loses, maximizing the votes the opposition party “wastes” whole districts at a time.

McGhee’s model generates the “efficiency gap” quotient or “EG” for a given voter plan. (See box.)

McGhee teamed with law Professor Nicholas Stephanopoulos to develop a potential legal test for gerrymanders supported by historical analyses of “efficiency gaps” in U.S. elections going back to 1972.

Their data suggested setting an EG of 7 as a presumptive constitutional limit — i.e., if your gerrymander forces the other party to waste 7 percent more of the statewide vote than your party, you probably are gerrymandering excessively and ought to provide an overriding justification.

In Whitford, the legislature’s intent to favor Republican candidates was clear. The efficiency gaps for Wisconsin’s gerrymander over three successive elections were off the charts: 13 for the 2012 election (which meant 48 percent of the statewide vote was converted to 60 percent of the assembly seats), and comparable EG’s and votes-versus-seats asymmetries in the 2014 and 2016 elections, confirming that Wisconsin’s gerrymander was both discriminatory and durable; in other words, a large slow-moving target for any court intent on finding a highly biased plan.

The Whitford court invalidated Wisconsin’s plan, and ordered the Legislature to prepare a new one in time for the 2018 elections. Wisconsin has appealed to the Supreme Court.

The 2011 gerrymander in a state like Wisconsin, with its relative statewide parity in party affiliation, and highly polarized politics, may have pushed gerrymandering close to a political breaking point.

The Supreme Court is not likely to find a red flag any redder than Wisconsin’s biased plan.

And though no measure to evaluate partisan bias is going to be perfect, it is difficult to imagine a standard markedly superior to the model developed by McGhee.

So the stakes are high. A judicial solution may be all that’s available for voters in the vast majority of states without independent districting commissions (like California’s).

And a solution from the ballot box would be a hard sell in gerrymandered states where votes for change are prone to be systematically “wasted.”

A loss for the Whitford plaintiffs would likely foreclose a judicial solution to excessively partisan gerrymanders once and for all, and consign large swaths of the country to a future of unbridled redistricting warfare, where the constitutional rights of millions of American voters are accepted casualties.

A victory for the plaintiffs, and for Eric McGhee’s idea, would assure American voters contending with the antidemocratic excesses of partisan gerrymanders that the Constitution is in their corner, at long last.

James Matson is an Oakland attorney with an interest in electoral reform. To comment, submit your letter to the editor at http://bit.ly/SFChronicleletters.

How the measure works

D — R

Total votes

= EG

Read formula as: Votes “wasted” by Democrats minus votes “wasted” by Republicans divided by the total votes cast in the election.

For example: If a gerrymander by Republicans “wastes” a higher percentage of Democratic votes than Republican votes, then the EG quotient goes up. If the EG quotient is higher than 7, Republicans’ gerrymander is deemed excessive and therefore unconstitutional.

Definition: Votes are “wasted” when they are cast for losing candidates, or for winning candidates beyond what was needed to win (the “over-vote”).

—James Matson