The transfer of political power is perhaps the most delicate moment in the life of a democracy. It follows an election which the party in power lost and its opponents won. Inevitably, feelings are raw, tempers are short, and mistrust can run high … all as control of the nation is changing hands.Because politics is how a self-governing society resolves its differences peacefully, it is essential that the rules of this transfer are as clear as they can be. If they are not, they can be exploited to create confusion and discord. In the extreme, as the world saw on Jan. 6, 2021, ambiguity on the page opens the door to bloodshed in the streets — exactly what the rules aim to avoid.This is why Republicans and Democrats in Congress are right to train their sights on fixing, at long last, the 135-year-old federal law that sets out the process for tabulating the electoral votes that decide who becomes president, known as the Electoral Count Act.Legal experts have been raising the alarm over the act for years. Its most consequential provision, dealing with Congress’s counting of electoral votes, is “a virtually impenetrable maze,” one scholar wrote in 2019. This was the provision that President Donald Trump, assisted by a posse of partisan lawyers, zeroed in on to encourage arguably unconstitutional behavior by Vice President Mike Pence and members of Congress, potentially criminal behavior by Rudy Giuliani and his dozens of fake electors, and obviously criminal behavior by hundreds of rioters who laid siege to the Capitol.It doesn’t matter whether any of these people actually believed the wild claims about how the Electoral Count Act works, if they had heard of it at all. The law’s confounding language created the space for a seductive narrative about a stolen election, and a legal path to take it back.More than a year later, Mr. Trump continues to lie about the law, revealing in the process his utter contempt for the most basic democratic principles. “Mike Pence did have the right to change the outcome, and they now want to take that right away,” Mr. Trump said late last month in a statement opposing E.C.A. reform. “Unfortunately, he didn’t exercise that power — he could have overturned the election!”No, he could not. Mr. Pence acknowledged as much on Friday. “I had no right to overturn the election,” he said. Yet that much should have been crystal-clear even before 2020. Since it wasn’t, and since Mr. Trump shows every indication of planning to run again in 2024, it is imperative that Congress clarifies the law now — before anyone casts a ballot in that election, and before knowing which party will be in charge of the Senate or the House of Representatives. It’s not hyperbole to say that American democracy is at stake.To understand the mess of the Electoral Count Act requires a brief history lesson. The law arose out of one of the most controversial elections in American history, the 1876 presidential race, a nail-biter with disputes over electoral votes in several states, leading to an ad hoc congressional commission that haggled for months and did not settle on a clear winner until days before the inauguration. Rutherford B. Hayes, who in the end was awarded the presidency over the Democrat, Samuel Tilden, wrote that “radical change” was needed immediately to prevent a similar battle from tearing the nation apart. Still a decade went by before Congress took action, and the law it ultimately passed confused more than it clarified.Today, three reforms matter above all: clearly defining the role and powers of the vice president, of Congress and of the states in electing the president. All three are central to achieving the fundamental goal, which is to ensure that voters, and not partisan political officials, get to choose their leader.Let’s take each of the players in turn.First, the vice president. Contrary to the self-serving fantasies of Mr. Trump and the lawyers who schemed with him, like John Eastman, the vice president’s role on Jan. 6 is a straightforward one. Starting at 1 p.m., the job is to open the envelopes and announce the electoral-vote counts from each state, in alphabetical order, then call for any objections. That’s it.She or he has no authority to unilaterally reject electors from the states. The law already lays out this process, but its outdated language is vague and should be clarified in a way that leaves no room for mischief.Next, Congress. The national legislature has many responsibilities, but sitting as a presidential-recount board is not one of them. Whenever a state submits a single, uncontested slate of electors, as all 50 states did in 2020, Congress’s job is to accept it. The problem is that the Electoral Count Act makes it easy to throw a wrench in the works by allowing objections to a state’s submission if only a single senator and a single representative sign on. This sets off hours of debate and delay — a recipe for chaos, as Senators Ted Cruz and Josh Hawley demonstrated with their grandstanding around baseless allegations about voting irregularities that had been rejected by every court to consider them.To avoid a repeat of this shameful and reckless behavior, Congress should raise the bar significantly — by requiring the assent of one-quarter or even one-third of both houses to lodge an objection, and a supermajority to sustain one. It should also strictly limit the grounds for raising an objection in the first place.What if a state submits two conflicting slates of electors? And what if the two houses of Congress disagree over which slate is valid? That’s a different sort of problem, and while it didn’t happen in 2020, it did in 1876 and could cause a major crisis again in 2024 — if, say, a Trump-aligned governor who believes that election was stolen refuses to certify a valid popular-vote count that favors the Democratic nominee, and instead authorizes his state’s Republican electors to cast their ballots for Mr. Trump. (Think that sounds crazy? Then you haven’t been listening to David Perdue, the former senator running for governor of Georgia.) In such a scenario, the Electoral Count Act needs to make it clear that Congress should accept the electors who were chosen in accordance with state law.This is where the courts, and especially the federal courts, play an essential role. The law should leave no doubt that judges — and not political actors — have the last word in resolving any vote-counting disputes that arise between Election Day and mid-December, when electors meet in state capitals to cast their ballots.Last, but far from least, are the states themselves. Under the Constitution, state legislatures have the authority to appoint their electors however they choose. They can let the voters do it, as all 50 states do today, or they can do it themselves, as many states did in the early years of the Republic. The key point is, there are no backsies. Once a legislature has settled on a method, it may not change its mind because it’s not happy with the results on Election Day. If a state uses the popular vote to appoint electors, it is required to count those votes fairly and accurately, and to appoint electors in line with the outcome. As the speaker of the Arizona House of Representatives said last week in rejecting a bill that would have given the legislature the power to overturn the popular vote, “We gave the authority to the people. And I’m not going to go back and kick them in the teeth.’’Yet there is a glaring loophole in the federal law: If a state fails to make a choice by its prescribed method on Election Day, the legislature may step in and do as it pleases. This provision, even older than the Electoral Count Act, was written to address a narrow set of scenarios specific to the mid-19th century. Today it only invites abuse, as state legislatures can try to spin any outcome they don’t like as a “failed” election.Congress needs to limit this provision to real “failures” — a major natural disaster, terrorist attack or some other catastrophe, and even then only if it is impossible to arrange for a popular election afterward.Electoral Count Act reform is not the voting issue Democrats were hoping to push through Congress. They are rightly furious with Senators Joe Manchin and Kyrsten Sinema, along with every Senate Republican, for thwarting two badly needed bills that would have attacked many forms of voter suppression and partisan gerrymandering. Still, the current push to reform the act, whose proponents include Senators Angus King, Amy Klobuchar, Susan Collins and Mitt Romney, is worth the effort — not only because it will help protect the integrity of the presidential election, but because it may well be the only reform with enough bipartisan support to pass in this polarized moment.If its essential components do pass, Democrats can take comfort in knowing that politicians and lawmakers will have a much harder time undermining a valid vote. Republicans, who like to talk about the importance of states’ rights in our federalist system, can be reassured that Congress will stay in its lane and leave the power to appoint electors with the states, where it belongs.None of this would be an issue, of course, if the United States simply counted up all the votes and saw who won. In 2020, over seven million more Americans chose Joe Biden than chose Mr. Trump, a resounding victory that would have been impervious to all the legally dubious shenanigans Mr. Trump and his allies tried to pull. Even in the closest election of the last half century, in 2000, the national popular-vote margin was more than half a million — far more than the margins of victory in all the disputed states of 2000 and 2020 combined.But as long as we have the Electoral College, the process needs to be as clear and as foolproof as possible. Making it so will not guarantee that things run perfectly. After all, a political movement that is categorically unwilling to accept electoral defeat can do a lot of damage. But just because we can’t plan for everything is not an excuse to do nothing. When you make the perfect the enemy of the good, you get neither.The Times is committed to publishing a diversity of letters to the editor. We’d like to hear what you think about this or any of our articles. Here are some tips. And here’s our email: letters@nytimes.com.Follow The New York Times Opinion section on Facebook, Twitter (@NYTopinion) and Instagram. More