Conservative Argentine President Mauricio Macri suffered a resounding defeat in primary elections on Sunday.
The primary, in which presidential candidates from all parties take part, was won by his left-wing rival, Alberto Fernández.
Mr Macri, whose austerity measures have turned many voters against him, is hoping to win a second term in office in the presidential poll on 27 October.
But analysts say his chances of beating Mr Fernández now look very slim.
How do the primaries work?
Voting in the primaries is compulsory and is not restricted to party members but open to all those eligible to cast their ballot in the presidential polls. Whoever wins is therefore seen as a favourite for the presidential polls on 27 October.
The primaries were introduced in 2009 to cut down on the number of candidates running in the presidential elections with contenders having to win a minimum of 1.5% to be eligible to stand for the presidency.
What was the outcome?
With more than 95% of votes counted, the coalition backing Mr Fernández had 47.7% of the votes and that supporting President Macri had 32.1%.
Third was centrist former economy minister Roberto Lavagna with 8.2%. The remaining candidates all had less than 3%.
The result is seen as a rejection by voters of the harsh austerity measures introduced by President Macri in an effort to stabilise Argentina’s battered economy.
- Argentina – the crisis in six charts
- Why confidence in Argentina’s economy is dwindling
Argentina is in a recession and has one of the highest inflation rates in the world. The local currency, the peso, lost half of its value against the dollar last year.
While inflation has come down in recent months from a high of 57.3% in May, this seems not to have translated in support for President Macri’s policies.
What does it mean for the election?
If Mr Fernández were to get the same percentage or more of votes in the presidential election on 27 October, he would win it outright, without the need for a second round.
Under Argentine election rules, if a candidate wins at least 45% of the vote or gains 40% with a 10-percentage-point lead, that candidate is declared the outright winner.
If there is no outright winner, a second round will be held on 24 November pitting the top two candidates against each other.
Who is Alberto Fernández?
The 60-year-old lawyer is a member of the main opposition coalition, Frente de Todos.
His candidacy for the presidency came as somewhat of a surprise as former president Cristina Fernández de Kirchner – to whom he is not related – had been widely tipped to be the opposition coalition’s candidate for the top office.
But in May she announced in a video posted on social media that she had “asked Alberto Fernandez to lead a team that includes both of us, him as the presidential candidate and me as candidate for the vice position”.
While Mr Fernández served as cabinet chief both under Ms Fernández and her husband and predecessor in office, Néstor Kirchner, he does not have the same name recognition as his more famous running mate.
Mr Fernández’s relations with his running mate have been rocky in the past. After leaving her administration in 2008. Mr Fernández became a vocal critic of his former boss but he later dismissed their disagreements as “what happens to many Argentines, that you fight among friends because you disagree over politics”.
What has the reaction been?
Mr Fernández celebrated his success by stressing his commitment to change. “We are confident that Argentina needed to end with this chapter and start another page. I am confident that today Argentines have started to write another story,” he said after the results were announced.
President Macri said that he “recognised” that he had had a “bad election” and that he would “redouble” his efforts to gain the support he needs to win the presidential election in October.
Argentine markets reacted with predictable dismay to the news that the country is likely to be in for a change of political direction.
In early trading, Argentina’s main Merval stock index fell 10%, while the peso slumped 25% against the dollar.
Investors fear the return to power of Ms Fernández de Kirchner, who presided over an administration remembered for a high degree of protectionism and heavy-handed state intervention in the economy.
Edward Glossop, Latin America economist at Capital Economics, said Mr Macri’s government would probably pull out all the stops to try to shore up popular support.
This could include easing the pace of economic austerity imposed as part of Argentina’s agreement with the International Monetary Fund.
“An outright loosening of the purse strings is possible. The IMF would probably turn a blind eye to this, since it is in its interest for President Macri to secure re-election,” he said, but added: “We doubt that these efforts would be enough to change voter perception.”