Hungary's president said on Tuesday that a referendum will be held on October 2 on whether to accept or reject mandatory quotas from the European Union on relocating migrants in member states without their parliament's approval.
President Janos Ader said in a statement posted on his office's website that the referendum will be about the following question: "Do you want the European Union to be entitled to prescribe the mandatory settlement of non-Hungarian citizens in Hungary without the consent of parliament?"
The country's right-wing Prime Minister Viktor Orban fiercely opposes the EU migrant scheme. The government announced its intention to hold the referendum earlier this year.
Hungary has already sued the EU at the European Court of Justice regarding an earlier plan to redistribute 120,000 asylum seekers already in the bloc among its 28 countries.
Emboldened by Britain's shock vote to quit the EU, Orban went ahead with his own referendum on migration, in what European diplomats see as a sign of battles to come with anti-Brussels populists across the continent.
Budapest says that the plan -- which has been extremely slow to get going -- violates its national sovereignty and that "terrorists" might enter the country disguised as migrants.
As of July 1, fewer than 2,800 people -- 789 from Italy and 1,994 from Greece -- have been relocated, according to EU data. Hungary has made zero places available but is meant to take in 1,294 people.
The 53-year-old Orban, in power since 2010, has long had a testy relationship with Brussels with critics saying that his shake-up of Hungarian institutions on issues such as independence of the courts and the central bank from 2010 -- since mirrored in fellow EU member Poland -- has undermined democracy. But his stance during Europe's migrant crisis, which has seen more than a million people undertake a perilous journey to the continent, has caused particular ire.
Around 400,000 migrants and refugees passed through Hungary in 2015 before the government sealed off the southern borders with razor wire and fences in the autumn.
The authorities also brought in tough new laws punishing illegal entry and vandalism of the fences. Last year the government erected billboards warning foreigners not to take jobs from Hungarians.
Orban said after Britain's June 23 referendum decision to leave the EU -- he had urged Britons to remain in adverts taken out in British newspapers -- that a big factor was immigration.
"The British wanted to find a way to resist this exodus of modern times," Orban said.
EU leaders "have done nothing to stop the wave of migration... which has led to less security, an increase in danger and aggression."
Hungary's opposition Socialist Party accused Orban on Tuesday of wanting to pull Hungary out of the EU "using the wildest lies".
The government is planning a billboard, television and Internet campaign urging voters to "send a message to Brussels that they will understand!"
In order for the plebiscite result to be valid, turnout needs to be above 50 percent, and previous referendums have struggled to reach this level.
His next clash pits him against an EU Commission plan to resettle refugees across member states based on quotas, which Orban sees as an act of out-of-touch Brussels bureaucrats usurping national authority.
"We need to fight to prove to people that it is possible to form an EU migration policy that is in line with the Hungarian national interest," Orban said days after the Brexit vote.
"This is going to be a long struggle for which I will need a strong mandate, which cannot be ensured without a referendum," said Orban, who is in favor of remaining in the EU but wants more powers for member states.
Orban has enlisted allies, such as neighboring Slovakia, which also opposes the quotas and this week joined a chorus of eastern EU states calling for the powers of the EU Commission to be reined in after Britain's vote to leave.
"We have a big problem with the proposed reform of the Dublin system," Slovak Prime Minister Robert Fico said.
"We think it's stupid, because this is exactly what will keep dividing Europe if (countries) will be asked to pay 250,000 euros ($277,000) for each migrant they refuse to take."
Hungary's migrant referendum, due in the autumn, could coincide with Britain starting its EU exit negotiations. Critics describe the timing as opportunistic.
"Eurosceptic parties across the continent are cherry-picking parts of the Brexit story to bolster their own domestic narrative," said Otilia Dhand, an analyst at Teneo Intelligence.
"Orban has said that it is the 'failure of EU migrant policies' that nudged UK voters to vote Leave - downplaying the fact that we're talking two completely different migrant issues: Syrian refugees on the continent vs. Polish workers in the UK."
The EU migrant relocation scheme was established last year after more than a million people entered the EU, most intending to settle in Germany and other rich northern countries. The EU is discussing a change to asylum rules that would require member states to accept a quota of refugees or pay a penalty for them to be housed elsewhere.
Hungary was the main arrival point into the EU's border-free Schengen zone for migrants travelling by land, until Orban shut the frontier with the new fence last year, a popular move at home that was criticized by rights groups.
He and other eastern European leaders say their comparatively poor countries should not be forced to settle migrants lured to the bloc by more liberal policies of richer states. Germany, which argued for the resettlement, says the entire bloc must act to solve a common problem.
Orban has said the migration crisis could drive more countries out of the EU. On Thursday, Orban's chief of staff, Janos Lazar, went further, becoming the first senior government official to say he would be in favor of leaving the EU altogether, although he said that was only his personal opinion.
Foreign diplomats say that despite such rhetoric, a "Huxit", or Hungarian exit from the EU, still seems unlikely. Hungary depends on EU funds, and Hungarians, a generation removed from Communist dictatorship, are still mostly keen on membership.
"I ask the people around me: if you ever meet a Hungarian who would rather go back to Siberia from where the Hungarians are coming from, rather than stay in the EU, I will buy champagne for him and treat him to a special lunch," one diplomat said. "So far, no one showed up."
But diplomats also see Orban's position as part of a "rebellious current" in Europe that has seen Dutch and French eurosceptic leaders calling for referendums on EU membership. The referendum tactic could poison debate.
"This referendum is not good," said another diplomat. "You can handle the bad ideas with the right means, and this is maybe the most destructive means of all. This can have a damaging effect on Hungary.
"Okay, maybe the EU is a little sick, maybe the EU has got a flu. But I am not going to cure the flu with chemotherapy. And this is what Orban seems to be trying with this criticism. And Brexit can strengthen politicians like him all around Europe."
Charles Robertson, Global Chief Economist at Renaissance Capital, said Orban was successfully tapping the public mood.
"The Brexit vote, swung to Leave by the immigration debate, is a powerful rejection of the status quo by the electorate," he said. "Orban captures that zeitgeist better than most."