Hungarians overwhelmingly supported the government in a referendum on Sunday called to oppose any future, mandatory European Union quotas for accepting relocated asylum seekers. But nearly complete official results showed the ballot was invalid due to low voter turnout.

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.

With 99.25 percent of the votes counted, more than 3.2 million voters — or 98.3 of those who cast valid ballots — backed the government. But turnout stood at 43.9 percent, the National Election Office said. Fifty-percent-plus-one-vote was needed for the referendum to be valid.

About 4 percent of the votes were spoiled — twice as many as in any of the other four referenda held since 1997 — driving down the number of valid votes to just below 40 percent.

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?"

Orban's Fidesz party claimed victory immediately after voting stations closed, saying its own projections based on exit polls showed that 95 percent of voters supported the government position despite an expected turnout of only 45 percent.

"Today is a sweeping victory for all those who reject the EU's mandatory, unlimited quotas," said Fidesz vice chairman Gergely Gulyas. "It is a sweeping victory for all those who believe that the foundations of a strong European Union can only be the strong nation states."

At the same time, analysts said the relentless government campaign against the EU's refugee relocation schemes had oversaturated citizens.

"Orban was able to dominate public discourse with an issue in which the majority was on his side," said Tamas Boros, analyst at Policy Solutions, a political research and consultancy firm. "But it seems he went too far and overestimated how much people's opinions are transformed into votes."

With a weak opposition in parliament and practically limitless campaign spending to promote the government position, the referendum's lack of validity was considered distressing for the government.

"Considering there was hardly any counter-campaign, that they spent some 50 million euros ($56.1 million) and everyone on the right took up the issues wholeheartedly, it's an embarrassing but not totally catastrophic defeat for Orban," Boros said. "It is his first national defeat since 2006, the first time in a decade that the prime minister cannot impose his will."

Orban argued that "No" votes favored 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.

"The most important issue next week is for me to go to Brussels, hold negotiations and try with the help of this result — if the result if appropriate— achieve for it not to be mandatory to take in the kind of people in Hungary we don't want to," Orban said after casting his vote in an elementary school in the Buda hills.

Orban, who wants individual EU member nations to have more power in the bloc's decision-making process, said he hopes anti-quota referendums would be held in other countries.

"We are proud that we are the first" he said. "Unfortunately, we are the only ones in the European Union who managed to have a (referendum) on the migrant issue."

The invalid result because of the low turnout would make Orban's quest to persuade Brussels to drop the refugee quotas more difficult.

"With an invalid result, it is harder for Orban to claim he holds all the aces" against Brussels, Boros said. "The EU will see that while there is a majority against the quota, it's not the most important issue for Hungarians."

Separately from the referendum, the Orban government is also suing at the European Court of Justice because of the EU's 2015 decision to relocate 160,000 asylum seekers from overburdened Greece and Italy. 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 have called on citizens to stay 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 toward 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 last year rejected over 80 percent of the asylum claims made in the country, one of the highest rates in the EU, according to Eurostat, the EU's statistical office. The country granted asylum to 508 refugees, rejected 2,917 applications and had nearly 37,000 claims still being processed.