Hungarians who voted in a referendum on Sunday have overwhelmingly rejected mandatory EU migrant quotas, the national election office has said.
But exit polls suggest that turnout failed to reach the 50% needed for the result to be valid.
With nearly all the votes counted, 98% rejected the quotas, officials said.
Right-wing Prime Minister Viktor Orban urged Hungarians to reject the EU scheme, describing it as a threat to Europe’s security and way of life.
He described the result as “overwhelming” and said the EU “cannot force” Hungary to accept migrants. He urged EU decision makers to take note of the referendum.
The EU plan to relocate 160,000 migrants across the bloc would mean Hungary receiving 1,294 asylum seekers.
During last year’s migrant crisis, Hungary became a transit state on the Western Balkan route to Germany and other EU destinations.
Vote sparks Hungarian poster war
Why Central Europe says ‘No’ to refugee quota
Relocation deal explained
In an effort to curb the influx, it sealed its border with Serbia and Croatia. The measure was popular at home but criticised by human rights groups.
The BBC’s Nick Thorpe in Budapest says that if the poll is declared invalid it would be a disappointing result for the Fidesz government following months of mobilisation and an expensive campaign.
Voters were asked: “Do you want the European Union to be able to mandate the obligatory resettlement of non-Hungarian citizens into Hungary even without the approval of the National Assembly?”
Image copyright AP
Image caption Mr Orban has said immigration is a “threat” to Europe’s “safe way of life”
Shortly after voting, Mr Orban said: “Hungarians are aware of what is at the stake. And it’s important because it’s not about the will of the government, it’s not the intention of the parliament. It’s the voice and will of the people – that’s most important.”
The EU proposal was meant to ease pressure on Greece and Italy, the main entry points for migrants and refugees into the bloc.
In December Hungary filed a court challenge against the EU plan, which would see relocations over two years.