An overwhelming majority of Hungarians are expected to reject the European Union's migrant quotas in a referendum on Sunday, which should boost Prime Minister Viktor Orban's standing at home and embolden him in his battles with Brussels.
Orban, who has been in power since 2010, is among the toughest opponents of immigration in the EU, and over the past year he has sealed Hungary's southern borders with a razor-wire fence and thousands of army and police border patrols.
After casting his vote in a wealthy Budapest district on Sunday, Orban told reporters that he would go to Brussels next week to start talks, empowered by the outcome of the referendum.
"And I shall try, with the help of the outcome, if this is an appropriate outcome, to achieve that we should not be obliged to accept people in Hungary whom we don't want to live with."
He also said his government might modify the Hungarian constitution after the vote.
In a letter published in a daily newspaper on Saturday, Orban again urged Hungarians to send a message to the EU that its migration policies were flawed and posed a threat to Europe's security.
"We can send the message that it is only up to us, European citizens, whether we can jointly force the Union to come to its senses or let it destroy itself," he wrote in the Magyar Idok.
While Budapest says immigration policy should be a matter of national sovereignty, human rights groups have criticized the government for stoking fears and xenophobia, and for mistreating refugees on the border.
Last year, hundreds of thousands of migrants fleeing war and poverty in the Middle East crossed Hungary on their way to richer countries in Western Europe, this year Hungary recorded around 18,000 illegal border crossings.
Around 1,500 people demonstrated in Budapest on Friday against the referendum.
Orban's hardline approach on migration has won allies in Central Europe. Eastern Europe's ex-communist states, now in the EU, are opposing a policy that would require all EU countries to take in some of the hundreds of thousands of people seeking asylum in the bloc.
Opinion polls show support for a rejection of EU migrant quotas of more than 80 percent among those who say they will vote. But they also indicate turnout might not necessarily top the 50 percent required for the poll to be valid.
Erzsebet Virag, voting near Budapest's eastern railway station where a year ago thousands of migrants camped outside waiting to get on trains toward Vienna, said:
"I voted (No) because there are a lot of poor people in our country too and if more poor people come in we will be even poorer and have to work even more."
Voting will close at 1700 GMT. Preliminary results are expected after 1800 GMT.
Orban has linked mass immigration from the Middle East to an increased risk of violent attacks in EU societies.
The anti-migrant rhetoric has gone down well with many Hungarians at home, cementing his Fidesz party's lead over the opposition.
"We must preserve our Hungarian national character here in the middle of Europe and all the other European states should also preserve their national characters," resident Judit Hegyi said as she took a leaflet from a Fidesz stall in Budapest in the run-up to the vote.
But others raised their voice against government propaganda which they say vilifies refugees and incites hatred. Some said that with the campaign and the referendum, the government only wants to divert attention from corruption, and problems in healthcare and education ahead of 2018 national elections.
"We came here so that we would be less ashamed of ourselves on Sunday night," said Zsuzsa Berkesi, 46, a teacher, one of those who demonstrated in the capital on Friday.
"I expect the worse: that it will be valid, with more than 50 percent of people voting, and this makes me sick."