JAKARTA, Indonesia — Facebook says it will not allow foreign-funded advertisements for upcoming presidential and legislative elections in Indonesia, the world’s third-largest democracy, hoping to allay concerns that its platform is being used to manipulate voting behavior.

The announcement on Facebook’s website said the restriction in Indonesia took effect Monday morning and is part of “safeguarding election integrity on our platform.”

Facebook and other internet companies are facing increased scrutiny over how they handle private user data and have been lambasted for not doing enough to stop misuse of their platforms by groups trying to sway elections. Critics say foreign interests and Russia, in particular, used Facebook to harvest private data and disseminate paid ads that may have influenced the outcomes of the 2016 US presidential election and the UK referendum on leaving the European Union.

Indonesians vote for president and national and regional legislatures on April 17. The presidential campaign pits incumbent leader Joko Widodo against ultranationalist former Gen. Prabowo Subianto, who was narrowly defeated by Widodo in 2014.

The social media company, which also owns Instagram and WhatsApp and has about 2.3 billion users for its Facebook site alone, said it’s using a mix of automated and human intervention to identify foreign-funded election ads.

It said the restriction applies to any ads coming from an advertiser based outside of the country “if it references politicians or political parties or attempts to encourage or suppress voting.”

The company said it had also prohibited foreign-funded advertisements for Nigeria’s elections in February and for Ukraine’s elections later this month.

For upcoming elections for the European Parliament and India, it has said advertisers will need to be authorized to buy political ads and a new tool will provide information about an ad’s budget, the number of people it reached and demographics about who saw the ad, including age, gender and location.