Before we learn the outcome of this year’s elections, it’s worth pausing to reaffirm one important truth: Any disputes that might arise over the counting of ballots in close elections should be resolved impartially. Unfortunately, that’s not always how it goes.

After the polls close on Tuesday and preliminary vote tallies are reported, candidates in close races will face the inevitable temptation to twist the rules in their favor. The candidate who leads will push to interpret the rules to minimize the counting of disputed ballots. After all, the leader has nothing to gain by including additional votes. The candidate who trails, conversely, will have every incentive to construe the rules generously to count contested ballots.

Historically, this structural dynamic has superseded partisan ideology. In general, Democrats tend to favor more generous rules for counting questionable ballots. Republicans, by contrast, tend to prefer stricter rules for determining which ballots are valid. But in an actual vote-counting dispute, if the Democrat is ahead and the Republican behind, these ideological tendencies will quickly give way to the immediate imperative to prevail in the race at hand.

We saw this, for example, in the 2008 U.S. Senate election in Minnesota. After the Democrat, Al Franken, pulled ahead during the recount, his legal team immediately switched to advocating a “strict compliance” standard for reviewing the eligibility of rejected absentee ballots. His Republican opponent, Norm Coleman, who initially had argued for strict compliance, was forced to switch to a more lenient “substantial compliance” standard once he fell behind.

This year, in particular, the temptation may be especially strong to distort the vote-counting process to achieve a victory for one side or the other.

This phenomenon of strategy over ideology has, however, an important benefit: It provides a firm foundation for bipartisan electoral reform. Before elections are held, when candidates and their lawyers don’t know whether they will lead or trail in the event of an actual ballot-counting dispute, it is possible to craft a set of ballot-counting rules acceptable to both sides. One side or the other won’t love those rules once the proverbial “veil of ignorance” is lifted and they find themselves actually leading or trailing. But before that, they can hammer out mutually acceptable procedures that give fair consideration to the possibility of being ahead or behind.

In its first foray into the field of election law, the American Law Institute has released a new volume of principles for the resolution of ballot-counting disputes. As “reporters” for this project, we were responsible for preparing drafts for advisory committees to review and, ultimately, for ALI’s governing council and entire membership to approve. This nonpartisan process included, among its advisers, leading recount attorneys from both political parties who collectively had handled many of the major recounts (and related vote-counting disputes) of the last several decades.

Using the ALI’s traditional structure for its projects, the principles articulated in this project consist of formal “black-letter” provisions, which propose legal standards to be followed in an actual dispute, followed by explanatory “comments” illustrating how these provisions would apply to hypothetical cases or describing the reasons underlying them. For example, one black-letter principle provides that a ballot cast by an unregistered voter should nevertheless be counted if the voter attempted to register and the only reason the voter is not on the registration list is because of a government error. Other black-letter provisions concern the procedures for canvassing the precinct returns and conducting any subsequent recount.

Meanwhile, one of the many hypothetical illustrations contemplates the possibility that college students, without any nefarious intent but in violation of a state law that prohibits submitting absentee ballots in bulk, might conduct an on-campus get-out-the-vote drive that includes collecting absentee ballots from dorm to dorm, for purposes of bulk submission to the local board of elections. If state law does not explicitly add that absentee ballots submitted in violation of this prohibition must be disqualified (as a form of penalty for the violation beyond whatever fine or other punishment might apply), then in deciding a case like this a state judge would ideally look to a general principle of avoiding the disenfranchisement of eligible voters (together with an obligation to preserve the integrity of the election).

Before election night results begin to arrive, we cannot know whether these new ALI principles will favor Democratic or Republican candidates in particular races. But that is precisely the point. Adopted in ignorance of any specific dispute, these impartial principles are inherently unbiased. Consequently, they are the best available guide for handling whatever disputes actually occur.

This year, in particular, the temptation may be especially strong to distort the vote-counting process to achieve a victory for one side or the other. Given the refrain that the current elections are uniquely important to the fate of the nation, it may be easy to convince oneself that “the ends justify the means” and that the count must be conducted to maximize the prospect that the preferred party prevails, or otherwise the country will go to ruin.

But if either side succumbs to this temptation, democracy itself will seriously suffer. The losing side loses faith in the result, and the lesson is ultimately to fight fire with fire by manipulating the counting of ballots whenever one has the opportunity.

Therefore, if we want to maintain a commitment to democracy, we must adhere to impartiality in the adjudication of vote-counting disputes and commit to the proposition that controversies over counting be settled insofar as possible by rules and principles in place before the casting of ballots. The best way to do that, particularly after such a venomous campaign as this latest one, is for those resolving an election dispute to employ the kind of ahead-of-time principles that the American Law Institute has developed. The need for such principles is more acute than ever.