Given the powerful role of social media in political contests, understanding the Russian efforts will be crucial in preventing or blunting similar, or more sophisticated, attacks in the 2018 congressional races and the 2020 presidential election. Multiple government agencies have investigated the Russian attack, though it remains unclear whether any agency is focused specifically on tracking foreign intervention in social media. Both Facebook and Twitter say they are studying the 2016 experience and how to defend against such meddling.

“We know we have to stay vigilant to keep ahead of people who try to misuse our platform,” Alex Stamos, Facebook’s chief security officer, wrote on Wednesday in a post about the Russia-linked fake accounts and ads. “We believe in protecting the integrity of civic discourse.”

Critics say that because shareholders judge the companies partly based on a crucial data point — “monthly active users” — they are reluctant to police their sites too aggressively for fear of reducing that number. The companies use technical tools and teams of analysts to detect bogus accounts, but the scale of the sites — 328 million users on Twitter, nearly two billion on Facebook — means they often remove impostors only in response to complaints.

Though both companies have been slow to grapple with the problem of manipulation, they have stepped up efforts to purge fake accounts. Facebook says it takes down a million accounts a day — including some that were related to the recent French election and upcoming German voting — but struggles to keep up with the illicit activity. Still, the company says the abuse affects only a small fraction of the social network; Facebook officials estimated that of all the “civic content” posted on the site in connection with the United States election, less than one-tenth of one percent resulted from “information operations” like the Russian campaign.

Twitter, unlike Facebook, does not require the use of a real name and does not prohibit automated accounts, arguing that it seeks to be a forum for open debate. But it constantly updates a “trends” list of most-discussed topics or hashtags, and it says it tries to foil attempts to use bots to create fake trends. However, FireEye found that the suspected Russian bots sometimes managed to do just that, in one case causing the hashtag #HillaryDown to be listed as a trend.

Clinton Watts, a former F.B.I. agent who has closely tracked Russian activity online, said that Facebook and Twitter suffered from a “bot cancer eroding trust on their platforms.” But he added that while Facebook “has begun cutting out the tumors by deleting false accounts and fighting fake news,” Twitter has done little and as a result, “bots have only spread since the election.”