Croatia is holding its first parliamentary election since joining the European Union in 2013 — and the outcome threatens to disrupt the flow of tens of thousands of refugees crossing the Balkans if conservatives return to power and implement tough measures against the surge.

Croatia's ruling center-left coalition faces a strong challenge in Sunday's vote from the center-right opposition, with the two running neck-and-neck in pre-election polls.

Over 300,000 asylum-seekers fleeing wars and poverty in the Middle East, Asia and Africa have passed through Croatia since mid-September in their search for a better life in wealthier EU countries such as Germany or Sweden.

The crisis has been a challenge for Croatia's ruling Social Democrats, but they skillfully used the influx to divert attention from critical economic problems and improve their plummeting ratings ahead of the vote.

Their leader, Prime Minister Zoran Milanovic, managed the daily flow of thousands by dispatching them first straight to neighboring Hungary and then — when Hungary shut its borders to the refugees — to Slovenia, alienating the two EU neighbors in the process.

The opposition Croatian Democratic Union, led by former spy agency chief Tomislav Karamarko, has claimed Milanovic's government is too lenient toward the refugees and has demanded tougher measures such as deploying troops and building fences at the border with Serbia, where most enter Croatia.

"The migrant crisis came at the perfect time for Milanovic to divert voters' attention from real problems facing the country, such as the economy," said political analyst Zeljko Milardovic. "He was virtually politically dead only a few months ago."

But building fences and slowing down of the trek of tens of thousands would further raise regional tensions because no country along the Balkans route that leads from Turkey to Greece, then Macedonia, Serbia, Croatia and Slovenia wants the refugees to be stranded on its territory.

Karamarko's anti-migrant policies have received support from Hungarian Prime Minister Viktor Orban, who has stopped the flow into his country by building a razor-wire fence on the border with Serbia and Croatia, triggering wide international condemnation.

"Croatia is threatened by a huge wave of migrants entering the country," Orban's letter of support, read out at a conservative rally, said. "Croatia desperately needs a change. There's one man who can do it and that is Tomislav Karamarko."

Croatia, with the population of 4.2 million, has one of EU's poorest economies. It recently emerged from a six-year recession but unemployment is hovering around 16 percent, of which 43 percent among young people.

Neither the conservatives nor the left-wing coalition are expected to win an outright majority in Sunday's vote, so the Croatia's next government will depend on several small parties in the 151-seat parliament.

"These elections are highly unpredictable," analyst Milardovic said. "If no one manages to form a majority for the government, we could even see a grand coalition between the two biggest parties, a technical government or a repeat of the vote."

Sunday's vote represents a revival for the conservatives, who led Croatia during its war from independence from the Serb-led Yugoslavia in the 1990s and then dominated its political scene for years. Their popularity plummeted since 2013 after a series of corruption trials against top officials.

The presidential election victory last year of a conservative, Kolinda Grabar-Kitarovic, was a clear sign that Croatia is shifting to the right after a four-year rule of the center-left bloc.

Karamarko campaigned on patriotism and creating new jobs, while Milanovic promised economic revival and warned against allowing Croatia to return to its conservative past.

"There will be no return to the past," Milanovic said at a recent rally. "I promise you that."