Members of an Afghan family with eight children get into a police minibus near Asotthalom, south of Budapest, after illegally crossing the Serbian-Hungarian border.
Photograph: Zoltan Gergely Kelemen/EPA

What came first – the refugees or the rhetoric? In Hungary, suddenly one of Europe’s most anti-immigration nations with its billboards and planned border fence, it’s hard to say.

Certainly public opinion has swung against migrants in a year when a record 61,000 asylum seekers have entered Hungary. A poll in April found that 46% of Hungarians classified themselves as anti-immigrant, more than three times higher than in the early 1990s when polling began.

But the surge in xenophobia has also coincided with a pointed government anti-immigration campaign which critics say is aimed at shoring up faltering support for the ruling Fidesz party and divert attention from escalating poverty and corruption scandals.

Fidesz, which has lost ground to the far-right Jobbik party since the autumn, is running a Hungarian-language billboard campaign that the UN has denounced for stirring up xenophobic attitudes. Ostensibly aimed at illegal migrants, it features slogans that tell them to respect Hungarian culture and laws, and warns “if you come to Hungary, you should not take Hungarians’ jobs”.

It has also sent voters a “national consultation” questionnaire that critics say equates immigration with terrorism. The government of prime minister Viktor Orbán is also planning to erect a barbed wire fence along the Serbian border. Any further plans to combat migration are yet to be seen, although last week Péter Szijjártó, Hungary’s foreign minister, floated the idea of fencing off the whole country if necessary.

However, the Hungarian government’s drive has galvanised Hungary’s politically unrepresented liberals against the Orbán government: the spoof political Two Tailed Dog party raised 26m forints (£59,000) to fund a counter billboard campaign in only three days, while other anti-government activists have ripped or doctored posters to subvert their messages.

Márk Kékesi and Balázs Szalai decided to take matters into their own hands by whitewashing seven anti-immigrant billboards in Szeged, a southern Hungarian town that has become a transit zone for many illegal migrants.

A woman walks past a vandalised anti-immigration billboad in Budapest that says: ‘If you come to Hungary, you have to respect our laws!’ Photograph: Bela Szandelszky/AP

“We bought 14 litres of white paint and began our act of civil disobedience. When we started painting, passing drivers honked their horns to show their support. Nobody abused us and the police left us alone,” Kékesi said, adding that the government was “deceiving the voters with public money: it was our patriotic duty to make these alterations”.

No fresh poll has been released about the change in sentiments towards migrants since the billboard campaign, according to Róbert László, of the Budapest-based thinktank Political Capital.

“But as the migrant issue has been on the agenda since January, it can be assumed that the record high proportion of anti-migrant respondents is in part a consequence of the government rhetoric,” he said.

“A 2014 Eurbarometer poll saw only 3% of Hungarians say that immigration is one of the two main issues that the country is currently facing,” László noted, adding that he was “pretty sure” this ratio was significantly higher now.

Daniel Fazekas, of the social media intelligence company Bakamo.Social, said: “Since 1 April, when Hungarians made seven comments on immigrants on social media, that number has proliferated, peaking at 422 on Thursday, which suggests that Orbán has successfully put the issue at the centre of national debate”.

Online forums devoted to discussion on migrants have also emerged.

Eva, a Hungarian pensioner, told the Guardian: “If you want to work in this country and come through the borders legally, you are welcome. What I have a problem with is the fact that the camps are open. In Austria, people cannot walk in and out freely. They should be quarantined to check they don’t have any diseases. They can harass local people, they could contract diseases, and it is a problem and it is a threat.

“There are certain steps that need to be taken. Hungary is not a rich country and cannot support thousands of people. Families are being thrown out onto the street, if we cannot help them then we don’t need immigrants. Nobody wants illegal immigrants.”

On Friday, the Hungarian Railway Company banned refugees – the vast majority of whom say they are planning to move to Germany or Austria – from waiting overnight for morning trains inside the station in Szeged, citing “risk of infection”.

Nevertheless, local residents are still bringing food and water for the mostly Afghan and Syrian refugees, many of them young families. The following day a group of ultra-nationalist football fans posted online a picture of their “ongoing patrols” of the Hungarian-Serbian border near Szeged. The post, which has received more than 1,000 likes on Facebook, noted that they had not seen any migrants as yet, although they had found several damaged fences.