The denunciation filled the front page of one of Hungary’s main newspapers. “Facebook has become a political actor,” declared the pro-government Magyar Nemzet, the latest attack in an escalating campaign against the social media giant.

In Hungary, Facebook’s attempts to clean up its platform and salvage its reputation are increasingly bringing it into confrontation with the government. The resulting showdown highlights worrying flaws in the systems that the US company has created to stamp out fake news, hate speech, bot armies and other “bad actors”.

The immediate target of the newspaper’s ire was Facebook’s new controls on political advertising, rolled out after the Cambridge Analytica scandal spurred worries about “dark ads” online. Because the rules cover promotion of any political content, news articles are caught up in the dragnet, and paid promotion automatically banned. “They allow users to issue death threats against [Viktor] Orbán, but we can’t advertise the Sports Daily,” the paper fumed.

In the US and western Europe, Facebook has protected the ability of major media to advertise their content by creating a “whitelist” of reputable news organisations. But the rest of Europe has not been covered, and so no news outlets can promote any content. It is just one way that Hungary and other small countries appear to be treated as second-tier nations by a company uncertain how to handle political, legal and commercial minefields.

For months, Facebook’s top executives have paraded their new systems of control around the world, insisting they are apolitical. Yet efforts to tackle abuse are premised on a functioning democracy, with legal checks and balances, a free press and a vibrant civil society. The company has sidestepped the question of what to do in places without those institutions, arguably the very places most vulnerable to propaganda and manipulation.

Hungary is proving to be a crucible, where Facebook’s ability to police its network is being tested.

This year the nation slipped down Freedom House’s global rankings of liberty and democracy, to become the only “partly free” country in the European Union.

The institutions that Facebook relies on to police content elsewhere, from campaign groups to a free media, are being undermined, shut down or forced out. Among the most direct impacts, Facebook does not have a fact-checking partner in Hungary. No organisations met its standards, a spokesman said, so the company has simply fallen back on tools it admits are insufficient.

The lack of checks means fake content festers online on prominent pages. A video investigated by independent magazine HVG, which was posted by Origo, one of the country’s biggest news websites, showed a woman being mugged in a church, with a soundtrack of shouting in Arabic. Blazoned across the screen was “Europe, 2017”. The video actually showed a 2015 attack inside a US cathedral; both attackers were American. More than a year later it is still on Facebook.

Nor has Facebook laid out any guidelines for how it plans to balance its commitment to political neutrality with its promise to clean up the platform in cases when a government, its allies or opposition are behind fake news, hate speech and other bad behaviour, a dilemma the company has already faced in Hungary.

Last year the company took down a video of a senior Hungarian politician blaming crime on immigrants, for violating the platform’s rules, but the next day restored it. “Exceptions are sometimes made if content is newsworthy or important to the public interest,” Facebook said.

This muddled approach appears to satisfy neither the government nor its critics. Facing increased scrutiny from Facebook, as more and more content is reported as inappropriate and removed, the Orbán government has moved on to the offensive.

Facebook Twitter Pinterest The government of Viktor Orbán has moved on to the offensive. Photograph: Rex/Shutterstock

Századvég, a government-connected thinktank, published a long report on Facebook last month complaining that the company’s “principles of political correctness” mean that more and more Hungarian politicians and public figures have become “victims of censorship”. Content has been deleted or accounts suspended, especially for sharing posts linking immigrants to terrorism or crime, a staple of the Hungarian pro-government media narrative.

The thinktank commissioned a poll it said showed that 79% of Hungarians found it unacceptable for a social media site to “delete content based on its own political views”.

Most ominously, the report came up with a serious of recommendations for governments to tackle Facebook’s supposed bias including “harsher legal steps against whoever wants to inhibit freedom of speech and freedom of opinion”.

While there are few specific details, it reads like the ground is being prepared for a legal campaign against Facebook by the government.

Peter Kreko, a political analyst, says the government is smarting from the advertising ban, as it relied on media allies to bolster its message, and may well see if it can move against the US firm. “I think they won’t be shy about trying to limit the operations of Facebook if they don’t feel its a useful tool for them any more for campaigning,” said Kreko, who works at the thinktank Political Capital.

“On the one hand, [this ban] is really hurting them. They have used Facebook so far as an important tool in the campaign system. On the other hand they are happy to use this opportunity to present themselves as victims.”

János László runs an NGO that funds Print it Yourself, a campaign distributing samizdat leaflets in the Hungarian provinces in a bid to counter government control of information. He said simply posting information on Facebook was pointless, as most people do not go to the site for news. They can only be targeted by paid content that will appear on their Facebook feed. “For us, as a small NGO, it’s too expensive, so we use printed materials instead,” he said.

Pro-government media accounts have been able to use their advertising to parachute stories into the feeds of those people who do not follow media outlets online and whose friends may not normally share political content.

HVG found a disturbing pattern of Facebook use from several pro-government news outlets ahead of elections last year. Perhaps most egregious was the Facebook page of TV2, which posted no videos in the months before and after the election, but more than 120 in the month voters went to the polls. The page went from no views to 13 million views almost overnight. There were similar spikes from no videos or views to more than 5 million views on the website Origo.

The videos were posted more than a year ago, and brought to Facebook’s attention more than a month ago, but the company said it had not had time to investigate. Nor are the problems faced by Hungary like to stay inside its borders. While most videos uncovered by HVG were probably aimed at Hungarians, not all controversial content made there has been. Last year the government’s official account posted a video – in English and with an American accent – attacking Guy Verhofstadt, chief Brexit representative for the European parliament.

It included fake content, using a photo from 2014 to purportedly illustrate events after 2015, and took Verhofstadt’s comments out of context. Facebook refused to take it down, even after Verhofstadt complained. But the choice of language indicated that its main audience was probably outside Hungary.

“Social media fake news does not stay within the border’s of a country that produces it,” said Andrea Chalupa, a writer and expert in disinformation.

She added: “This is another urgent reason why countries like Hungary and Russia, which attack and undermine journalists and watchdogs, require well-funded and effective fact-checking safeguards from Facebook. It’s a matter of public safety and security.”