Over 98 percent of voters reject EU plans after less than 50 percent turn out for the referendum.
An overwhelming majority of Hungarians who voted in Sunday’s referendum have rejected the European Union’s plans to relocate refugees and migrants among member states.
However, turnout stood at 43.9 percent, the National Election Office said, below the 50 percent threshold for the vote to be valid.
With 99.25 percent of the votes counted, more than 3.2 million voters, or 98.3 percent of those who cast valid ballots, backed the government.
The government claimed a "sweeping victory" while analysts said that the result was an "embarrassing but not totally catastrophic defeat" for Prime Minister Viktor Orban.
The invalid result, because of the low turnout, would make Orban’s quest to persuade Brussels to drop the refugee quotas more difficult.
But in a "victory" speech on Sunday, Orban said the vote must be taken into account by EU decision makers.
"Thirteen years after a large majority of Hungarians voted at a referendum to join the European Union, today Hungarians made their voices heard again in a European issue," Orban told a news conference.
"We have achieved an outstanding result, because we have surpassed the outcome of the accession referendum."
Orban said that he would submit an amendment to Hungary’s constitution to put the result of the plebiscite into law.
The referendum asked: "Do you want the European Union to be able to prescribe the mandatory settlement of non-Hungarian citizens in Hungary even without the consent of Parliament?"
Before the referendum, Orban argued that "No" votes favoured Hungary’s sovereignty and independence.
If a majority of voters agree, Hungary’s parliament would pass legislation to advance the referendum’s goal whether or not turnout was sufficient for a valid election, he said.
While the referendum has no binding legal consequences for the EU, Orban hoped its passage would increase pressure on Brussels.
"We are proud that we are the first" he said.
Inside Story: Warding off a potential refugee threat or challenging Brussels?
"Unfortunately, we are the only ones in the EU who managed to have a referendum on the migrant issue."
Separately from the referendum, the Orban government is also taking the EU’s 2015 decision to relocate 160,000 asylum seekers from overburdened Greece and Italy to the European Court of Justice.
Under the original plan, 1,294 asylum seekers would be moved to Hungary.
Polls show that the relentless campaign urging citizens to "send a message to Brussels", while associating migrants with terrorism, has increased xenophobia in Hungary.
Several opposition and civic groups had called on citizens to stay at home and boycott the vote.
Others urged casting invalid ballots that would not count in the final tally, but still could be interpreted as rejecting the government’s "zero migrants" policies.
Nearly 400,000 migrants passed through Hungary last year while making their way towards Western Europe.
Razor-wire fences erected on the border with Serbia and Croatia, along with new expulsion policies, have reduced the numbers significantly this year.
Last month, police reported either zero or just one migrant breaching Hungary’s border area on 13 different days.
Hungary rejected more than 80 percent of the asylum claims made in the country last year, one of the highest rates in the EU, according to Eurostat, the EU’s statistical office.