SAN FRANCISCO — Eight of the tech industry’s most influential companies, in anticipation of a repeat of the Russian meddling that occurred during the 2016 presidential campaign, met with United States intelligence officials last month to discuss preparations for this year’s midterm elections.

The meeting, which took place May 23 at Facebook’s headquarters in Menlo Park, Calif., was also attended by representatives from Amazon, Apple, Google, Microsoft, Oath, Snap and Twitter, according to three attendees of the meeting who spoke on condition of anonymity because of its sensitive nature.

The company officials met with Christopher Krebs, an under secretary for the Department of Homeland Security, as well as a representative of the Federal Bureau of Investigation’s newly formed “foreign influence” task force.

Neither the Department of Homeland Security nor the F.B.I. responded to a request for comment.

Companies like Facebook and Twitter have been changing the way they operate to counter the kind of misinformation that plagued the two social services in 2016. But the May meeting was the first significant discussion between a group of tech companies and intelligence officials ahead of the 2018 midterm elections.