Much of the support for Bernie Sanders and Donald Trump this year comes from voters who feel the system is rigged. On Monday the Fourth Circuit Court in Richmond lent support to that notion.

Sanders and Trump themselves agree—at least in broad strokes. Sanders says he "wouldn't use the word rigged," just "really dumb." Trump is (surprise!) not so restrained: "It's a rigged system, it's a corrupt enterprise."

Those complaints look a trifle odd coming from those sources. Nationwide, Hillary Clinton received 3 million more votes than Sanders did in the Democratic primaries and caucuses. Trump complains the system is rigged and corrupt in one breath—and then boasts about how many states he won in the next.

Merits aside, Trump and Sanders are complaining about the nominating processes of the Republican and Democratic political parties, which are essentially private organizations. Any advantages or disadvantages a candidate faces are imposed by internal party rules, not the machinery of government.

That's not the case regarding third parties, which face obstacles imposed by law. In Virginia, one of those obstacles arises from the ordering of candidates on the ballot. State law stipulates that candidates from the major political parties (defined as those getting at least 10 percent of the vote for a statewide office in at least one of the past two statewide elections) will be listed first. In practice that means Democrats and Republicans. The second class of candidates belong to "recognized political parties," which didn't get at least 10 percent but have a party apparatus, and they are grouped and listed next. Independent candidates are listed third.

Two years ago Robert Sarvis, a former Libertarian Party candidate for governor, challenged the ballot-ordering law in court. The wheels of justice grind slowly, so it was only Monday that the Fourth Circuit issued a ruling that upheld a district court's decision to dismiss the case. In short, the Fourth Circuit found that the ballot-ordering law did not unduly burden the constitutional rights of Sarvis or other Libertarians. States have the authority to regulate elections, the court said, and Virginia has legitimate reasons for ordering the ballot the way it does.

The ruling illustrates a point too often overlooked: "unfair" is not a synonym for "unconstitutional." But then the converse is also true: "constitutional" is not a synonym for "fair."

Considerable research has shown the prevalence of a phenomenon called the serial position effect, which shows up just the way you would it expect it to: Given an ordered list, people tend to remember the first and last items more. Not only that, but they also tend to select items closer to the top of the list more—whether they are clicking internet links or picking items from a restaurant menu.

Or, notably, casting ballots for candidates. Research on voting patterns in Ohio, for instance, found that when candidate names were rotated on the ballot, the candidate listed at the top "received, on average, two-and-half percent more of the vote than those listed after."

Similar effects show up elsewhere: A study of New York primaries "found that in 71 of those contests candidates received a greater proportion of votes simply because they were listed first on the ballot. In seven of the contests the candidate listed first won his race by a smaller margin of victory than the increased percentage of votes gained by being first on the ballot. This striking evidence suggests that nearly 10 percent of the elections in New York would have had a different outcome if candidates were randomly placed on ballots."

The order of names on a ballot matters. That is why, as Ballot Access News pointed out, "ironically, Virginia does require random placement of each candidate within each category." Neither Republicans nor Democrats get listed first all the time in the first ballot tier—and imagine the uproar if they did.

There's another irony. In 2013 Sarvis won 6.6 percent of the vote. It's possible he could have broken 10 percent if his name has appeared first on the ballot. So Virginia's ballot-order law may amount to a Catch-22: A minor-party candidate can't get to the top of the ballot until he or she breaks 10 percent, but he or she probably can't break 10 percent without being listed at the top of the ballot.

This year Libertarian presidential nominee Gary Johnson is polling right around 10 percent. But as a third-party candidate, he still will face many statutory obstacles similar to the ones Sarvis faced. When Sanders and Trump gripe about a rigged system, he probably thinks: "Brother, you have no idea."

This column originally appeared at the Richmond Times-Dispatch.