MEXICO CITY — Angry and frustrated over corruption and violence, Mexican voters delivered a tidal wave presidential election victory to leftist Andres Manuel Lopez Obrador, giving him a broad mandate to upend the political establishment and govern for the poor.

An official quick count from electoral authorities late Sunday forecast that Lopez Obrador would win with between 53 percent and 53.8 percent of the votes, a remarkable margin not seen in the country for more than three decades. Early Monday, with about 40 percent of the votes counted, Lopez Obrador’s advantage was close to the quick count’s statistical sample.

A prominent exit poll predicted his party allies were poised to score big victories in congressional races, possibly winning absolute majorities in the Senate and the Chamber of Deputies.

Lopez Obrador, who campaigned on vows to transform Mexico and oust the “mafia of power” ruling the country, rode widespread voter anger and discontent with the governing Institutional Revolution Party, or PRI, of President Enrique Pena Nieto and had led opinion polls since the beginning of the campaign.

The PRI, which dominated Mexican politics for nearly the entire 20th century and recaptured the presidency in 2012, was set to suffer heavy losses not just for the presidency but in other races as well.

In brief remarks at a hotel in central Mexico City, Lopez Obrador called for reconciliation after a polarizing campaign and promised profound change but with respect for the law and constitutional order.

“I confess that I have a legitimate ambition: I want to go down in history as a good president of Mexico,” said Lopez Obrador, who had lost in the previous two presidential elections. “I desire with all my soul to raise the greatness of our country on high.”

The president-in-waiting, whose term will begin Dec. 1, devoted much of his speech to appealing to citizens of all stripes and seeking to reassure those who have eyed his candidacy nervously.

“This new national project will seek to establish an authentic democracy and we do not intend to establish a dictatorship,” Lopez Obrador said. “The changes will be profound, but in accordance with established order.”

Conservative Ricardo Anaya of a right-left coalition and the PRI’s Jose Antonio Meade acknowledged defeat shortly after polls closed nationwide. The quick count had them around 22 percent and 16 percent, respectively.

Lopez Obrador’s supporters began wild celebrations in Mexico City, cruising up and down the central Paseo de la Reforma boulevard honking horns to the tune of “Viva Mexico!” and waving Mexican flags from car windows and moon roofs.

Thousands poured into the sprawling main square known as the Zocalo, where the 64-year-old former mayor of the capital had called on his backers to rally. Many danced to the trills of mariachi music.

Retired teacher Susana Zuniga beamed and said the country was experiencing a moment similar to the Mexican Revolution a century ago.

“The people are fed up. That is what brought us to this,” she said.

U.S. President Donald Trump tweeted congratulations: “I look very much forward to working with him. There is much to be done that will benefit both the United States and Mexico!”

Lopez Obrador said individual and property rights would be guaranteed, promised respect for the autonomy of the Bank of Mexico and said his government will maintain financial and fiscal discipline.

He said contracts obtained under energy reforms passed under President Enrique Pena Nieto will be scrutinized for any corruption or illegality, but otherwise contracts will be honored.

“There will be no confiscation or expropriation of assets. … Eradicating corruption will be the principal mission,” he said.

Lopez Obrador also spoke of support for migrants and said the most forgotten and humble people of Mexico will be given preference in his government. He said he will seek a relationship of “friendship and respect” with the United States. And rather than the use of force to fight spiraling violence, he will look to fix root causes such as inequality and poverty.

“Peace and tranquility are the fruits of justice,” Lopez Obrador said.

Exit polling by Consulta Mitofsky for the Televisa network forecast gubernatorial wins for allies of Lopez Obrador’s Morena party in at least four of eight state races on the ballot plus for the head of government in Mexico City. The central state of Guanajuato was expected to go to a candidate of the conservative National Action Party.

Mitofsky predicted Morena allies would take between 56 and 70 seats in the 128-member Senate and between 256 and 291 spots in the 500-seat lower house.

“The anger that the average Mexican feels toward the way things are being governed has favored Lopez Obrador,” said Shannon O’Neil, senior fellow for Latin America Studies at the Council on Foreign Relations. “He’s been able to capture the mantle of the person who’s on the outside who wants change.”

In a speech to the huge crowd in the Zocalo, he struck a moderate tone, stressing a need to act respectfully, to maintain economic and financial stability.

He also pledged to increase support payments for the elderly and to give scholarships or paid apprenticeships to young people.

“Now that he has won, he cannot fail this new generation that believes in him,” said Mariano Bartolini, a 29-year-old lawyer who voted for Lopez Obrador in the northwestern city of Rosarito, near Tijuana. “It is thanks to us young people who are supporting him that he was able to get more votes than he did in past elections.”

___

Associated Press writers Maria Verza and Andrea Rodriguez in Mexico City and Nancy Moya in Tijuana contributed to this report.