The scenario was fake but the vulnerabilities were real, a scrimmage designed to test the abilities of federal and local law enforcement to work together and respond to a nation-state attack.

After Russians attempted to interfere with the last presidential election, the U.S. government and private sector have worked to shore up communications and cooperation and get ready for 2020.

“It’s really only since 2016 that these sort of real-time scenarios have been happening,” said Eddie Perez, global director of technology development for the Open Source Election Technology Institute (OSET), a nonprofit that conducts election technology research.

NBC News has collaborated with the OSET Institute since 2016 to monitor U.S. election technology and voting issues.

“Contingency planning and tabletop exercises that help state and local election officials to be more prepared for the unexpected are a good example of how they are ‘upping their game,’" Perez said in an email. “They’re an essential part of protecting public trust in the 2020 elections.”

Simulations like these have become more common among federal and local officials, but Tuesday’s event added the unique element of attacks on critical infrastructure.

The hackers even made fake voice calls to impersonate the local election officials’ superiors. Then they told the officials to reset the voting machines, focusing on those without paper backups, spreading chaos and confusion.

The simulation also included technology not currently available in the U.S. that could someday could become a target.

At one point, the hackers noticed the city was piloting a fleet of self-driving buses. They compromised the bus controls, commanding them to crash into lines of voters at polling sites, killing and wounding some of the fake town’s citizens.