The Russia-friendly Czech president, Miloš Zeman, has won the first round of voting to retain his job, according to nearly complete results from Saturday’s poll.
However, he will face a formidable challenge from the pro-western runner-up, Jiří Drahoš, in the second round of voting in two weeks.
The vote was seen as a referendum on the 73-year-old Zeman, in office since 2013, who has criticised immigration flows from Muslim countries and Germany’s decision to accept many migrants.
While most Czechs share his views on immigration, Zeman’s inclination towards far-right groups and his warm relations with Russia and China have split public opinion, with a sizeable chunk of the electorate favouring pro-western candidates, including 68-year-old academic Drahoš.
Czech presidents have limited executive powers, but Zeman and his predecessors have had a strong influence on public debate. They are also pivotal in forming governments – which the European Union and Nato member country is now trying to do.
With votes from 98.9% of districts counted, Zeman led the race with 38.6%, while Drahoš had won 26.6%.
That means a run-off needs to be held and the balance of power may be closer than the first round showed. Four other candidates who ended between the third and sixth place and among them won 32.5%, all endorsed Drahoš for the second round due on 26-27 January.
A win for the soft-spoken, grey-haired chemical engineer Drahoš could mean the tone of the Czech leadership shifts closer to the EU mainstream.
The outcome may also influence the chances of the Czech prime minister, Andrej Babiš, of forming a cabinet. His first attempt to rule in a minority administration is likely to be rejected by parliament next week.
Zeman has backed Babiš and said he would give him another chance even though the billionaire businessman has struggled to get support from other parties while he battles police allegations that he illegally obtained EU subsidies a decade ago. Babiš denies wrongdoing.
A former centre-left prime minister and backer of a federal Europe, Zeman has gradually shifted to positions criticising the EU, echoing and reinforcing public sentiment.
He has won endorsements from some mainstream groups, as well as the Communist party and the main far-right anti-EU and anti-Nato SPD party.
“The first round result is a heavy blow for Miloš Zeman, although he won it formally. It shows he doesn’t have much more where to take the votes,” said political scientist Josef Mlejnek. “They will try to picture [Drahoš] as a friend of migrants, an agent of the EU.”
The Czech Republic has a tiny Muslim minority and has seen only a few of the hundreds of thousands of people coming to Europe in recent years to seek safety from war or better life.