RIO DE JANEIRO (AP) — Brazil’s President Luiz Inácio Lula da Silva, a vocal critic of President Donald Trump, was reelected Sunday in a result that provides relief to critics of widening U.S. influence in Latin America.

With 100% of the vote counted, Brazil’s electoral court announced that the soon to be 81-year-old Lula had a lead of nearly 4.4 million votes - 51.8% of the total vote - over opponent Flávio Bolsonaro. The announcement capped an evening of chaos at polling places across Brazil, following a last-minute decision to extend voting by two hours. That decision by a Supreme Court justice may trigger legal action by Bolsonaro.

His triumph bucks a trend in Latin America where increasing numbers of right-of-center presidential candidates allied with Trump have been winning. Lula’s victory leaves Mexico and Brazil, Latin America’s two most populous nations, with left-of-center leaders. It also positions Latin America’s largest economy, with a GDP of $2.6 trillion per year, to remain independent of the U.S., despite the pressure of increased tariffs imposed by Trump.