There have been clashes on the streets of Ecuador as supporters of the right-wing presidential candidate in a ballot on Sunday claim fraud.
Former banker Guillermo Lasso is set to face narrow defeat but has already announced he disputes the result, calling for a recount.
Supporters of Lasso clashed with police as they took to the streets to protest.
The victor in these elections will replace President Rafael Correa, who has been in office for three terms.
The leftist government candidate Lenin Moreno, who was supported by Correa, has claimed victory.
A Lasso defeat would be a relief for WikiLeaks founder Julian Assange whom Lasso had promised to remove from the Ecuadorian embassy in London.
Assange has been holed up for almost five years in the embassy, where he has protection from extradition to Sweden over rape allegations.
Assange set to stay in Ecuador embassy as leftist on verge of winning election https://t.co/IHH6s0fyZO via
Reuters</a></p>— Seamus Kearney (seamuskearney_) April 3, 2017
Assange also sent this Tweet when the results started to confirm a Lasso defeat.
There was confusion among supporters of Lasso; he started to celebrate after exit polls showed he would be the likely winner but as more results came in the balance tipped.
Most of the votes are in but an official winner has not yet been declared by election officials.
The victor will take office on May the 24th.
AFP news agency (@AFP) April 3, 2017
BREAKING: Ecuador opposition candidate Lasso says he will challenge election results, alleging fraud. https://t.co/7KHRhg2miN— The Associated Press (@AP) April 3, 2017