Voters cast their ballots in Athens, Ga., on Tuesday. (Joshua L. Jones/AP)

When top intelligence officials went to Capitol Hill one morning this week to give House members a classified briefing on the security of the upcoming elections, only 40 or so bothered to show up.

In other words, 9 out of 10 lawmakers thought they had better things to do than listen to an assessment of threats to the integrity of a closely contested midterm that is less than six months away.

“Well, it was at 8 o’clock,” Homeland Security Committee Chairman Michael McCaul (R-Tex.) said.

The handful who attended did not come away reassured that much is being done to harden defenses and prevent a repeat of what happened in 2016, when Russian hackers made an effort to infiltrate voter-registration files and balloting sites in 21 states.

Elections are handled with varying degrees of competence and sophistication by states and counties, using a wide array of mechanisms for keeping track of who is registered to vote and how their ballots are counted. Many are connected, in some way, to the Internet.

Notwithstanding President Trump’s absurd claim that he was deprived of a popular-vote victory because millions of people voted illegally for Hillary Clinton, there were isolated breaches that we now know were by Russia. While their attacks did not affect the 2016 presidential outcome, Russians gained access to the voter-registration database in Illinois, for instance, and stole the username and password of an election official in Arizona.

There is no reason to doubt that Moscow — and potentially other foreign powers — will try again this fall, when control of the House and Senate will be decided in hundreds of races across the country, surely by small margins in some places.

The Post recently asked 100 security experts — a panel put together from across government, academia and the private sector — whether state election systems are sufficiently protected against cyberthreats. Ninety-five said no.

Not least among the problems here is that the question of how to protect the most basic exercise of our democracy has become infected by political tribalism.

It starts at the top. While Trump spins vast conspiracy theories about witch hunts and corruption within the heart of this country’s law-­enforcement establishment, he refuses to accept the consensus view of the intelligence community that he was the intended beneficiary of Russian election interference.

As a result, those around him have to tread carefully — sometimes sidestepping reality as they do.

On her way out of the classified briefing, Homeland Security Secretary Kirstjen Nielsen was asked by CNN’s Manu Raju whether she agreed with the January 2017 intelligence community conclusion that Russian President Vladi­mir Putin “tried to meddle in this election to help President Trump win?”

“I do not believe that I’ve seen that conclusion,” she claimed. “That the specific intent was to help President Trump win? I’m not aware of that.”

Nielsen, through a spokesman, later tried to squirm out of that answer by saying the reporter’s question had not included the precise wording of the intelligence community’s report. But Raju accurately summarized the gist of it, so here is where we find ourselves: A Cabinet secretary in the most sensitive position imaginable pleads cluelessness, rather than say something that might set off the president.

Maybe all those House members who did not show up for the 8 a.m. briefing were right — listening to anything this administration has to say about election security is a waste of their time. If everyone cannot agree to accept the reality of what was going on in 2016, is there any reason to believe they would know how to prevent it from happening again in 2018?

Local control of elections is an American tradition, and one that should be respected. But Washington has a role to play here, too.

In March, Congress approved $380 million for states to beef up the security of their election systems. Much more needs to be done to assure a standard of ballot safety that does not vary depending on where you live.

States must install better and more sophisticated systems to detect hacking risks and replace old voting machines with ones that create backup paper ballots that can be audited.

Just as important, any foreign entity that attempts to influence U.S. elections should pay a stiff price for it. The sanctions that Trump has imposed on Russia thus far, which Congress demanded, have been minimal.

Time is running out. This isn’t about squabbling over what we see in the rearview mirror. It is about recognizing the threat that is rising in the windshield.