The Iran-linked pages and groups spread misinformation in the United States, United Kingdom, Latin America and the Middle East. Some of them posed as a group called “Liberty Front Press.”

Facebook (FB) said the coordinated campaigns originating in Iran included 254 Facebook pages and 116 Instagram accounts that amassed more than 1 million followers across the two services. Those behind the pages spent more than $12,000 on advertisements between 2012 and 2017, the company said.

Facebook, Twitter (TWTR) and other social media companies have been scrambling to protect their platforms ahead of the US midterm elections in November and prevent a repeat of the widespread disinformation seen during the 2016 presidential campaign.

Facebook CEO Mark Zuckerberg said the company’s attempts to identify fake pages, groups and accounts are making the social network safer.

“While it’s still early, we’re starting to see it pay off and we’re identifying more of this before the election,” he said on a call with reporters.

In a related development, Twitter announced on Tuesday that it has identified and removed 284 accounts, many of which it linked to Iran, for “coordinated manipulation.” The company said it is working with law enforcement and other tech firms.

The announcements underscore just how aggressively foreign actors are still seeking to covertly influence political conversations in countries around the world. Facebook’s revelation came after Microsoft (MSFT) took control of websites it said Russian military intelligence could have tried to use to hack American politicians.