Partly, that’s because private sector jobs tend to pay more. But it’s also because the government can be an inhospitable place for a hacker. Talented hackers can be disqualified for government jobs by strict background checks, and dissuaded by hiring processes that favor candidates with more formal credentials. At Def Con, I heard stories about hackers who had interviewed for government security jobs only to be turned away because they’d smoked pot as a teenager, or violated copyright law by jail-breaking their video game console.

These rules may keep a few bad apples away from critical government systems, but they also prevent many talented hackers from contributing. At Def Con, I spoke with Sean Kanuck, a former C.I.A. intelligence analyst who served as the federal government’s national intelligence officer for cyberissues from 2011 to 2016. He said that hackers could be enormously valuable, if they were properly enlisted in the fight against attacks.

“These people may be all hackers, and they may occasionally break the law, but they all still want the banking system to work,” Mr. Kanuck said. “All of them, if they end up in a hospital room, they want the infusion pump working. There’s common ground. And the knowledge here is incredible.”

The private sector has already discovered the benefits of hackers. Most major tech companies — including Facebook, Apple and Microsoft — offer “bug bounty” programs, in which they offer financial rewards to hackers who find holes in their security measures. These companies know that paying hackers up front for their expertise is significantly cheaper than cleaning up after a breach, and they understand that the risk of a hacker going rogue inside their systems is outweighed by the benefits of having well-trained experts catch bugs and vulnerabilities before the bad guys do.