An exit poll has projected that Sweden’s ruling left-wing Social Democrats have won the most votes in a general election, while a right-wing populist party had its best showing yet.

The exit poll published by Swedish public broadcaster SVT has a margin of error, and the final outcome will only be known once votes are counted.

There are eight parties running to win seats in the 349-seat parliament, or Riksdag.

They belong to one of two major blocs, one with four left-wing parties and another with four conservative parties.

The exit poll projected that the left had a slight edge over the right, with 176 seats to 173.

If the exit poll is confirmed by the official results, Prime Minister Magdalena Andersson would likely be in a position to remain in power.

Her Social Democrats party was projected to win 29.3% of the vote.

The election boosted a populist anti-immigration party, the Sweden Democrats, that promised to crack down on shootings and other gang violence that have shaken a sense of security for many in Sweden.

The party won 13% in 2018 and was projected by the exit poll to gain 20.5% support. Though it would be its best-ever result, disappointment at the party election headquarters was palpable as party members realised they were unlikely to form a new coalition government.

The populist party’s fortunes have risen following massive migration in recent years, particularly in 2015, and as crime has grown in segregated neighbourhoods.

It has its roots in the white nationalist movement but many years ago began expelling extremists. Despite its rebranding, voters long viewed it as unacceptable and other parties have shunned it.

Ms Andersson, a 55-year-old economist, enjoys high approval ratings. She became Sweden’s first female prime minister less than a year ago and led Sweden’s historic bid to join Nato following Russia’s invasion of Ukraine in February.

The poll projected that the centre-right Moderate party was projected to win 18.8%. The party leads the conservative opposition bloc under its leader, Ulf Kristersson. He ran on a pledge of “Sweden needs change.”

During the campaign, Ms Andersson voiced alarm at the rising popularity of the Sweden Democrats, characterising it as a far-right party that could erode Sweden’s identity as a place of tolerance and of refuge for the persecuted.

Tobias Andersson, a 26-year-old member of parliament for the Sweden Democrats seeking a second term, said his party was unfairly characterised as racist by opponents.

“I wasn’t even born when my party was founded, I don’t really care who founded it. I look at the values and policies that we support today,” he told the AP.

He said politicians who have called his party racist are now “pushing forward the same policies themselves.”

Most Swedes still oppose the Sweden Democrats, and some voted tactically against any right-wing party to prevent that faction from getting a chance to wield power.

Voting in Stockholm, Bjarne Frykholm, a 65-year-old computer specialist wouldn’t say who he voted for other than to make it clear he opposed the Sweden Democrats.

“I don’t want them to get any power at all,” he said. “I think they frighten me a lot.”