Prime Minister Krisjanis Karins's party was headed for victory in Latvia's general election on Saturday, according to an exit poll which also showed major setbacks for parties representing the Baltic state's large Russian-speaking minority.

The poll put Karins's New Unity in first place with 22.5 percent and said Harmony, a social-democratic party that has won the vote in recent years, could fail to make the threshold for entering parliament.

Latvians voted in the shadow of neighbouring Russia's invasion of Ukraine, with many concerned about Russian aggression and expansionism.

National security and support for Ukraine were key issues for many voters, as well as the need for stability in this country of 1.8 million people on the eastern edge of the European Union and NATO.

"The election results look rather promising for my own party but it's a little early to say," Karins told reporters after polls closed.

Regarding Russian threats, Karins said: "Neither I nor my government nor my country reacts on fear.

"We will continue to invest in our own defence as a NATO member state," he added.

Karins said he expected the consultations on forming a new government to begin on Monday.

Political expert Marcis Krastins said Karins was "most likely" to win, depending on how many smaller parties supporting him get past the five percent threshold for entering parliament.

"Russians invading Ukraine helps Karins to secure voters in Latvia because in such times people tend to rally around the flag," Krastins said.

The exit poll showed the United List, which includes the Greens and regional parties, coming in second place with 11.5 percent followed by the Green Farmers Union with 10.9 percent and National Alliance with 8.4 percent.

According to the exit poll, only one party representing the Russian-speaking minority, called Stability!, would scrape past the threshold to enter parliament with 5.4 percent.

The minority makes up around 30 percent of the population.

- Solidarity with Ukraine -

One voter said he made his decision based on the conflict raging nearby.

"I am 83 years old, I lived through Soviet and German military occupations... I am today making my choice depending on which party supports Ukraine the most against the Russian invasion," Verners Karkliņs told AFP.

"People are seeing that we are already in a storm, but it will only get stronger, and it's making people think more about their future and their country's future," President Egils Levits told journalists after voting.

Ahead of the vote, Levits had warned people against backing politicians in the Russian-speaking community who "hesitated to clearly state who is the aggressor and who is the victim at the outset of the Russian invasion".

Referring to the energy crisis and economic difficulties, he had also cautioned against populists saying he was "highly sceptical of political parties and figures promising to get us out of this mess quickly and easily.

"I do not trust those who offer simple, and most often useless, solutions to extraordinarily complex problems," he said.

Dominated over the centuries by Teutonic knights, Swedes, Poles, then Russians, Latvia gained independence in 1918 before finding itself under Soviet occupation in 1944-1990.

- Identity challenged? -

Along with inhabitants of nearby Poland and their Baltic neighbours Lithuania and Estonia, many Latvians feel their country is vulnerable even though it is in the EU and NATO.

The outgoing government has shown strong support for Ukraine, hiked defence spending and worked towards greater energy security.

The Harmony party condemned Russia's invasion but has been less vocal about accusations that Russian forces are carrying out human rights atrocities.

Some Russian speakers in Latvia said that Latvian attitudes towards them have deteriorated since the war started and feel their linguistic and cultural identity is being challenged.

"In Latvia, Russian-speakers are in a way collateral victims of the war," said Miroslavs Mitrofanovs, co-chairman of the Latvian Russian Union party, which scored only 3.2 percent in the exit poll.