The Swedish general election has left the two main political blocs almost tied, with the anti-immigration party making gains on its previous results.
With nearly all ballots counted, the governing centre-left coalition is marginally ahead of its centre-right Alliance rivals, with around 40% each.
The nationalist Sweden Democrats (SD) have won about 18% of the vote, up from 12.9% in the previous election.
A protracted battle to form a working coalition now looks certain.
Both of the main blocs have refused to govern with the SD, although its leader said he was prepared to talk with all other parties.
"We will increase our seats in parliament and we will gain huge influence over what happens in Sweden during the coming weeks, months and years," Jimmie Akesson told a party rally.
He had hoped to gain the support of one in five, or even one in four, Swedes, which some polls had also predicted. However, the results were closer to one in six.
Other European countries have seen support rise for anti-immigration parties in recent years. Earlier this year, Italy installed a new coalition government run by the anti-establishment Five Star and the right-wing League. In 2017 the far-right Alternative for Germany won 12.6% of votes, and The Danish People's Party won 21% in 2015.
Who stands with whom?
Sweden has become accustomed to coalition governments and no one was expecting an outright winning party in this election.
The current coalition, headed by outgoing PM Stefan Lofven, is made up of his Social Democrats and the Green Party, and is supported in parliament by the Left Party.
On the other side, the centre-right Alliance is made up of four parties: the Moderates, the Centre, the Liberals and the Christian Democrats. It was formed in 2004 to counter decades of dominance by the Social Democrats.
The main party in the Alliance is the centre-right Moderates and they have proposed Ulf Kristersson as their candidate for PM.
What happens now?
Sweden uses a system of proportional representation, under which each party is allocated a number of seats in each constituency that is broadly in line with its share of the vote.
Neither of the leading alliances has reached the threshold of 175 seats, which is needed to govern.
Mr Lofven's bloc holds 144 seats and the Alliance holds one less.
Overseas votes, which could make a slight change to the outcome, have not yet been counted and the final result is not expected until Wednesday.
Lengthy negotiations will follow to attempt to form a workable government. One option could be for one of the parties to switch alliances.
At a party rally on Sunday night, Mr Lofven refused to quit. "We have two weeks left until parliament opens. I will work on calmly, as prime minister, respecting voters and the Swedish electoral system," he said.
Could Sweden Democrats play wrecking role?
By Gavin Lee, BBC News in Stockholm
The headline in a Swedish National newspaper says it all, Dött Lopp, which means Dead Heat.
The governing Social Democrat party is the largest party, but because the centre left doesn't have a collective majority, it can't govern together in a coalition.
The opposition Moderate party is also unable to take over because even an established alliance with the centre-right parties doesn't make up the numbers needed for a majority.
Hence the leader of the nationalist Sweden Democrats, Jimmy Akesson's claim, that he is the "kingmaker" being the third most popular party - but that's a simplified view. No other party will consider the anti-migrant hard-right group in any form of coalition.
The Sweden Democrats could however play a role as possible home-wrecker for the Prime Minister Stefan Lofven. In roughly two weeks, Mr Lofven faces a confidence vote in parliament.
If he is forced to stand down, parliament would be dissolved and fresh coalition attempts would start in September.
Mr Akesson says Mr Lofven's party must enter into a dialogue with him, otherwise he will support a no confidence vote alongside the main opposition alliance and Mr Lofven would certainly go.
The prime minister must choose between: risking losing core voters by dealing with the party he calls racist; and bargaining, for the sake of his career.
Who are the Sweden Democrats?
The SD was linked for years to neo-Nazis and other far-right groups, only entering parliament in 2010.
It has been working to rebrand itself, changing its logo from a flaming torch (similar to the one used by the UK far-right National Front) to a blue-and-yellow daisy, the colours of the Swedish flag.
Traditionally appealing to working-class men, it wants to attract more women and higher-income voters.
Mr Akesson says there is zero tolerance towards racism in the party and several members have been expelled.
However, the party has still been embroiled in various racism scandals.
One municipal candidate shared a song on Facebook with the lyrics "Swedes are white and the country is ours", according to a report in tabloid Aftonbladet.
What were the key issues?
Sweden's economy is booming but many voters are concerned that housing, healthcare and welfare services have come under pressure from a wave of immigration during the 2015 migrant crisis.
That year Sweden took in a record 163,000 asylum seekers - the highest such intake in the EU, per head of population.
Sweden's traditional parties have since hardened their tone to reflect concerns about integration.
Many voters are also concerned about violence. The SD links a rise in shootings to increased immigration, although official figures show no correlation.
The SD also wants to leave the European Union and has proposed a "Swexit" referendum. However, the centrist parties all oppose such a vote, so it is unlikely to go ahead.
Aside from immigration, climate change is an issue many Swedes care about - particularly after a long, hot summer and severe forest fires.
During the heatwave, around 25,000 hectares of forest burned in wildfires. Support for the Green party, which had been struggling after various internal scandals, has crept up across the country.
Have you voted in the Swedish election? Get in touch by emailing firstname.lastname@example.org.
Please include a contact number if you are willing to speak to a BBC journalist. You can also contact us in the following ways: