(This January 27 story corrects number of asylum applications in paragraph 11 to make clear they refer to just the month of November)

PRAGUE (Reuters) - Czech President Milos Zeman won a second term in a presidential election on Saturday, gaining the backing of voters for his tough stance against immigration and his courtship of Russia and China.

In the run-off against strongly pro-European Union academic Jiri Drahos, Zeman scored 51.4 percent to 48.6 percent for his challenger.

Zeman, 73, is the last prominent figure among active politicians from the country’s post-communist transitional period in the 1990s, and has shifted from being a center-left prime minister 16 years ago to being a president with leanings toward the far-right.

The vote showed Czech voters’ concerns over security despite a period of fast economic growth and rising wages. Immigration was a key issue, more than two years after the European Union first faced a major influx of refugees - almost none of whom ever appeared in the Czech Republic.

The result will also influence the formation of the next Czech government, with Zeman one of the few political backers of Prime Minister Andrej Babis, whose minority cabinet lost a confidence vote this month due to fraud allegations hanging over the billionaire businessman.

Zeman has been a polarizing force, publicly belittling opponents and sniping at intellectual elites and the media. He was one of the few European politicians to back Donald Trump in the 2016 U.S. presidential election.

He has upset many with his warm relations with Russian President Vladimir Putin and calls to end EU sanctions against Moscow imposed over its annexation of Crimea.

His stance toward Brussels has been lukewarm. He calls himself a federalist and supports membership of the EU while also favoring holding an in-or-out referendum, like the one that led to Britain’s impending exit.

Speaking to supporters after claiming victory, Zeman said he would continue traveling the country to meet citizens and hear their worries.

“This is my last political victory, there will be no political defeats,” he told the crowd, flanked by advisers and the leaders of the far-right, anti-EU and anti-NATO SPD party and the Social Democrat party that he once led.

CLASH OF PERSONALITIES

Zeman has benefited from rising hostility to immigration, especially to people coming from Muslim states, although the country of 10.6 million received just 116 asylum applications in November last year and has only a tiny Muslim community.

Slideshow ( 6 images )

Both candidates rejected the EU’s refugee quotas, but Drahos was labeled weaker on the issue in attack ads in the last week by Zeman supporters.

“People around Milos Zeman ... managed to incite fear, a very strong emotion, which is much more important than reason,” political analyst Tomas Lebeda said.

The two presidential candidates were as different personally as politically. Zeman has a self-advertised appetite for alcohol and tobacco and his health is a concern - he suffers from diabetes, and walks with a stick.

Slideshow ( 6 images )

Drahos is a soft-spoken chemistry professor who promised a stronger voice in the EU, reversing the country’s aloofness that has put it closer to Poland and Hungary - two states often at loggerheads with the bloc’s executive.

“We did not win, but we didn’t lose either. I am terribly happy for this huge wave of energy,” Drahos told supporters.

“I am convinced this energy will not disappear.”

Zeman’s victory is good news for Babis, who was a runaway winner in parliamentary elections in October with pledges to fight political corruption and run the state better.

But police charges that Babis illegally obtained subsidies as a businessman a decade ago - which he denies - have left his party without ruling partners.

Zeman has pledged to give Babis a second chance to form a government and repeated on Saturday that he would let him have ample time.