Updated

Leftist candidate Lenin Moreno appeared on the verge of victory in Ecuador's presidential election but his opposition rival refused to recognize the results, calling on his supporters to take to the streets to guard against "fraud."

Sunday's second-round runoff in the Andean nation of 16 million was being watched closely as a barometer of whether the left, which had dominated South American politics for the past 15 years, could stop a string of right-wing victories across the region.

With more than 96 percent of voting acts counted, Moreno had 51 percent of the vote while conservative banker Guillermo Lasso had 49 percent. A difference of about 220,000 votes separated the two candidates with fewer than 300,000 still left to count.

Lasso said he would challenge the results in all of Ecuador's 24 provinces after three exit polls showed him winning. He also questioned why results that took three days to calculate following the first round of voting in February were announced so quickly in Sunday's runoff.

"This is very sickening. We're not going to allow it," said Lasso, adding that he had shared his concerns with the head of the Organization of American States in a phone conversation.

He accused President Rafael Correa of trying to install an "illegitimate" government.

Thousands of outraged Lasso supporters shouting "fraud" crashed through metal barricades to almost reach the entrance of the electoral council's headquarters in Quito. By midnight a few hundred protesters remained.

In Guayaquil, where Lasso is from, supporters shouted "Get out Correa!" and threw sticks at riot police in formation before being pushed back with tear gas. There were reports of small scuffles and clashes in other cities.

Correa accused Lasso supporters of trying to disavow the results and provoke violence, while the head of the electoral council, a favorite punching bag of the opposition, appealed for calm.

"Ecuador deserves that its political actors show ethical responsibility in recognizing the democratic will expressed by the people at the voting booths," said National Electoral President Juan Pablo Pozo.

So far the only evidence of possible fraud presented by Lasso's campaign are the results in one tiny provincial voting center that it said were reversed when they were reported to electoral authorities in Quito. There was no immediate comment from the OAS, which sent a mission of electoral observers.

Moreno, meanwhile, said he would start work immediately on his transition. With Correa standing behind him, the two joined supporters in singing leftist classics in an outdoor rally.

Outside the region, the election was being closely watched by supporters of WikiLeaks founder Julian Assange, who has been living under asylum at Ecuador's embassy in London since 2012. Before the election, Lasso had said he would evict the Australian activist, who is wanted for extradition by Sweden, within 30 days of taking office. Moreno said he would allow him to stay.

On his Twitter account shortly after the results became known, Assange took a jab at Lasso's pledge.

"I cordially invite Lasso to leave Ecuador within 30 days (with or without his tax haven millions)," he wrote.

Three exit polls had shown Lasso winning, including one that accurately predicted the first-round results and gave him a six-percentage point victory. A quick count of voting acts by a respected local watchdog found there was a technical tie with a difference of less than 0.6 percentage points separating the two candidates. The group refrained from saying which candidate had the advantage.

Correa said the exit polls had "lied."

"The moral fraud of the right-wing won't go unpunished," he wrote on Twitter.

For weeks Ecuadoreans polarized by 10 years of Correa's iron-fisted rule had been bracing for a contested vote

With Ecuador's economy slated to shrink by 2.7 percent this year as oil prices remain low and with a majority of citizens stating in surveys that they are eager for change, analysts had been anticipating that Ecuadoreans would back Lasso and join the growing list of Latin American nations — Argentina, Brazil, Peru and Venezuela — shifting to the right in recent elections.

Voters also looked hungry for change amid ongoing corruption allegations related to bribes Brazilian construction giant Odebrecht paid to officials in Correa's government and a $12 million contracting scandal at state-run PetroEcuador.

Yet in the final weeks of the race, Moreno had inched ahead in polls amid an aggressive campaign led by Correa to cast Lasso as a wealthy, out-of-touch politician who profited from the country's 1999 banking crisis. Moreno also benefited from last-minute doubts that Lasso if elected would gut social programs that have endeared poor voters to Correa's "Citizens' Revolution."

Moreno, who has used a wheelchair since being shot in an attempted robbery two decades ago, cuts a softer image than the infamously irritable Correa which was on display Sunday night as he addressed supporters.

"It's time for peace and union. Everyone will have a new opportunity and we will seek dialogue and harmony," said Moreno. "Our hand is outstretched."