Voters decide who wins an election, right? Not necessarily.

In fact, we may see partisan operatives determine the winner in the razor-thin race for Virginia’s attorney general. After the initial count, Democrat Mark Herring is ahead of Republican Mark Obenshain by a mere 164 votes out of 2.2 million. If Herring remains on top after a recount and any federal court litigation, then the next step is for the Republican candidate to initiate an “election contest” with the Virginia General Assembly.

This election contest is a procedure in which the losing candidate disputes the certified results. States have varying ways to resolve these controversies — and most use a process that allows partisans to determine the ultimate winner.

There are better solutions, however, than allowing a partisan legislature to decide. We can minimize ideology, actual or perceived, by creating a bipartisan entity that would resolve a post-election battle.

Yet in Virginia an election contest goes to the General Assembly sitting as a joint session, with the speaker of the House of Delegates presiding. Republicans now control a majority of the Virginia General Assembly seats — and have been pushing through a socially conservative agenda.

Some states allow their elected judiciaries to decide a disputed election. Still others have stranger processes. In Texas, for example, the governor decides an election contest for the state’s Presidential Electors. Imagine the presidential election coming down to Texas — the governor would then hold the key to determining the outcome.