Is America, the world's oldest democracy, capable of pulling off a half-way competent election?

You'd be forgiven for wondering. Nearly a week has passed since the midterm elections, yet an unsettling number of high-profile contests — in Georgia, Florida, and Arizona, for example — remained unresolved through the weekend. Allegations of fraud and demands for recounts, once a rarity, now seem to be the norm. And in the background, we have the president repeatedly shouting on Twitter about elections being "stolen."

Elections are designed to produce order. Instead, we're getting chaos. There are two main reasons for this.

First, it's become glaringly obvious that American elections are easily gamed. Elections are carried out at the state level: The rules for those elections are made by partisan state legislatures — and in Republican-led states, at least, those legislatures have been on a mission to make it harder to vote. Concerns about non-existent "voter fraud" have been used to justify a system of rules that, not coincidentally, makes it more difficult for Democratic constituencies to register and vote.

After the rules are made, the elections are overseen directly by elected partisans whose conflicts of interest couldn't be more apparent. Georgia's Brian Kemp and Kansas' Kris Kobach, both Republicans, acted as their states' chief elections officers during their own runs for governor this year. Kobach was defeated so handily that it wouldn't have mattered if he put his thumb on the scale, but Kemp's apparent victory in Georgia is so narrow that you can't blame his Democratic opponent, Stacey Abrams, for refusing to concede until the results are officially certified: It doesn't appear to have been a fair election.

The second problem is that it's very easy to game an election simply by screaming bloody murder about how your particular election is being stolen — whether it's true or not.

Take Florida. State law is very clear: Elections that end up with the winning candidate beating the losing candidate by a half-percentage point or less are automatically recounted. The idea is to produce fair results. Both the gubernatorial and Senate races ended up within that close margin. Gov. Rick Scott — a Republican running in the Senate race — has responded with allegations of fraud. He has offered no evidence to support his claims.

This isn't just petulance. It's strategy.

On Friday, Politico reported that national Republican leaders are frustrated with Rep. Martha McSally, who at the end of the weekend was losing a close Senate race to Rep. Kyrsten Sinema, the Democrat. Why were party leaders angry? Because McSally wasn't pressing the issue of fraud as aggressively as they wanted — even though, as CNN reports, "there are no allegations or evidence to support those claims."

Once again, Republicans mostly own this undemocratic moment. It's not that Democrats are incapable of bad faith in politics: As liberals became increasingly concerned about gerrymandering in recent years, a conservative friend of mine noted that shaping congressional districts for partisan advantage had long been a Democratic custom. "It's only when Republicans got good at it that liberals got mad about it," he said.

Right now, though, Republicans are creating most of the rules that make American elections less free and less fair, then crying "foul" when they lose elections anyway. They're helped by the fact that counting millions of votes quickly is difficult, and accuracy is vulnerable in a system prone to breakdown. When the results don't produce the GOP candidate as the victor, Republicans react by shaking voter confidence and undermining the legitimacy of the vote.

American democracy is in crisis. It has been, arguably, since the Supreme Court put an end to Florida vote-counting in 2000 and thus handed the presidential election to George W. Bush. Bush, of course, appointed justices who proved decisive in gutting the Voting Rights Act, which compounded the sense of alarm. The century started with a rarity — a close election that gave the victory to the popular vote loser — and has spiraled downhill from there. How many allegations of fraud, true and untrue, can the system endure before voters lose all confidence in their government? How many election results that seem to contradict the will of the voters?

One obvious solution to all of this is to stop letting partisans make the rules. California and Arizona have an independent commission that draws congressional district lines. More states should apply that model — and expand the authority of such commissions to include more questions about election rules, vote counting, and voter eligibility. And the newly Democratic House of Representatives can make a high priority of restoring and reforming the Voting Rights Act to ensure that all American citizens have rightful access to the ballot.

The good news is that Americans seem to have a real appetite for making our elections better. Voters in Florida last week approved a measure to restore voting rights to felons who have completed their sentences, while Michigan voters approved measures to automatically register voters and to allow no-excuse absentee voting. Counting millions of votes will always be hard — we will always have challenges and recounts — but there's plenty we can do to make our elections better, and to increase our collective confidence in the results.