MEXICO CITY — The landslide victory of leftist candidate Andrés Manuel López Obrador in Mexico’s presidential election on Sunday is the biggest political shake up the country has seen in decades — and it has the potential to change the way politics is done for decades more.

The 64-year-old baseball enthusiast won 53 percent of the vote, riding a wave of exhaustion and disgust with the country’s current leaders, who have led the country into a deep security crisis amid a cascade of corruption scandals.

Over 25,000 people were murdered in Mexico in 2017, according to official figures — the highest number ever recorded — and the numbers for the first five months of 2018 are up 15 percent on the same period last year. An estimated 130 political candidates and other public officials were assassinated just during the 2018 election alone.

In this environment, López Obrador — who had run for president twice before unsuccessfully — was finally able to capitalize on discontent with the status quo and gain broad endorsement of his promise to lead Mexico’s deepest transformation since its 1910 revolution.

He has promised to boot out “the mafia of power” by getting rid of corruption and instituting “republican austerity” in public spending; he’s promised to pay for massive new social programs with the money saved.

But his victory in this election is no accident. López Obrador (who is often referred to by his initials, AMLO) has been working up to this moment all his adult life. His triumph is built on a core of fervent supporters he has cultivated over many years, and who have stood firm despite many efforts to paint him as a dangerous populist who could plunge the country into chaos.

“There has been nobody like him in modern Mexican politics,” political analyst Jesús Silva-Herzog Márquez told me. “What is happening here is not normal.”

Here’s everything you need to know about Mexico’s soon-to-be new president: Where he comes from, what he stands for, and what his victory means for the future of Mexico — and its complicated relationship with the United States.

He was once called a “danger to Mexico.” Now he’s its next president.

The son of shopkeepers, López Obrador grew up in the waterlogged plains of the southeastern state of Tabasco.

His political career began in the 1970s within the Institutional Revolutionary Party, the PRI, the only party of any importance at that time. He abandoned it the next decade to join other political dissidents in forming the Party of the Democratic Revolution, the PRD.

Though still just a local leader in Tabasco, López Obrador was already thinking big, convinced of his unusual powers of persuasion.

José Angel Gerónimo, a close friend from those years, recalled getting a flat tire on a dirt road in the middle of a storm on their way to a political meeting. López Obrador left Gerónimo behind to fix the tire while he hitched a ride with the government spies who had been following them everywhere in a Volkswagen beetle.

“Don’t worry about them,” Gerónimo remembered López Obrador telling him when he questioned the wisdom of communing with spies. “They are of ‘the people’ too. Sooner or later they will come over to our side.”

López Obrador later failed to win two governorship elections in Tabasco because of alleged dirty tricks, but he continued to rise within the PRD, eventually becoming the party president in the late 1990s.

He completed his transformation into a national figure when he was elected mayor of Mexico City in 2000. That same year, Vicente Fox of the right-leaning National Action Party, or PAN, won the presidential elections that ended the PRI’s 71 uninterrupted years in power.

A pragmatic and astute term as mayor turned López Obrador into the favorite to win the 2006 presidential election. He worked with business leaders, reaffirmed his left-wing credentials by introducing a pension for the elderly, and constantly goaded Fox’s chaotic and uninspiring presidency.

When López Obrador refused to concede a narrow defeat to the PAN’s Felipe Calderón, after a brutally negative campaign claiming the leftist was a “danger to Mexico,” many wrote him off as a lost-cause radical.

But as the country descended into spiraling violence triggered by Calderón’s ill-conceived military offensive against organized crime, López Obrador was quietly securing a broader support base by visiting all of Mexico’s 2,446 municipalities.

A second run for president in 2012 ended with another loss, this time to the PRI’s telegenic Enrique Peña Nieto, aided by mass media support and the sense that the old party of power might be dirty, but it knew how to govern.

But López Obrador wasn’t done yet. Instead of giving up on ever becoming president, he undertook yet another countrywide tour. And he formed a brand-new party that answered only to him: the Movement of National Regeneration, or MORENA.

By the time campaigning for the 2018 election began, violence in the country was breaking new records as corruption scandals sprouted from every corner. The silver-haired AMLO didn’t look so scary anymore.

The cult of AMLO

López Obrador’s anti-establishment rhetoric has led some to call him “Mexico’s Trump.” Others have compared him to the British Labour Party’s unassuming leader Jeremy Corbyn, and even Venezuela’s revolutionary leader Hugo Chávez.

But none of these comparisons quite fit. Unlike Trump, López Obrador is a leftist and a career politician with a vocal distaste for luxury. Unlike Corbyn, who never thought he would win when he joined Labour’s leadership race in 2015, there is nothing accidental about López Obrador’s win. And unlike Chávez, López Obrador is a pragmatist.

The president-elect is no orator or political showman, but he does exude authenticity and conviction in a country where most politicians are assumed to be cynical opportunists. And the atmosphere at his rallies can be electric.

The delirious crowds streaming into Mexico City’s great Zócalo plaza to celebrate his victory beamed as they chanted, “It is an honor to be with Obrador!” Parents raised toddlers high to catch a glimpse of their hero. Some clutched AMLO dolls. Many had tears in their eyes. Asked to describe the reason for their devotion to him they used words like “honest,” “tenacious,” and “of the people.”

“I don’t think we have ever experienced this level of personalized politics that we are seeing with López Obrador,” said Silva-Herzog.

The analyst stops short of branding him a cult-like messiah figure, as some observers do, but he does warn that López Obrador basing his legitimacy on his connection with el pueblo (Spanish for “the people”) — defined as people who support him — threatens to weaken the country’s political institutions.

One close political ally said he worries about López Obrador’s scant interest in the legislative branch of government, because it may make it harder to get Mexicans more engaged with politics on any other level than with the president.

A member of his inner circle even admitted to me that López Obrador is such a strong leader that it could lead to a personality cult.

And now that his party, MORENA, has also won a large majority in both houses of Congress, those fears are even stronger, with old enemies raising the risk that López Obrador’s power will be almost unchecked.

So far he has reassured international markets and local business leaders that he will respect the autonomy of the Central Bank, keep the country’s books balanced and inflation under control, and not raise taxes. But he has also insisted there will be no U-turn on his commitment to “put the poor first.”

That includes campaign pledges of subsidies for peasants, boosting local industry with the aim of reducing dependence on imported goods, and a massive program of paid youth apprenticeships and student stipends under the slogan “Scholarships yes, cartel hitmen no.”

Eliminating corruption and slashing what he calls “offensive privileges” for public officials will pay for it all, he promises, though his explanations of how have focused on a pledge to lead by example.

In addition to promising to be uncorrupt himself, he says he will cut his own salary by half, and live in his modest middle-class home in the south of the city rather than in the presidential palace.

He also pledges to sell off the presidential plane and take commercial flights instead. Asked by an interviewer during the campaign what he would do if his flight was delayed on the way to a meeting of the United Nations General Assembly, he replied: “I will be late.”

López Obrador’s assurances that he can bring down the murder rate are equally vague. There will be 6 am meetings with security chiefs, an invitation to the Pope to get involved, and he might explore the idea of an amnesty for low-level cartel members.

Supporters often say they understand that AMLO’s vision of peace, prosperity, and social justice will take time. How long the honeymoon lasts is anybody’s guess.

“We are not going to get into fights” with the US

President Trump may be at the center of attention in the US, but neither he nor his promise to make Mexico pay for a wall along the two countries’ 2,000-mile shared border were big issues in the Mexican election. In fact, they barely registered at all.

Voters were far more concerned with the violence, crime, and corruption plaguing the country as well as the poverty that affects around half the population and the many years of only mediocre economic growth.

But everybody accepts that Mexico’s relationship with the US is important. Last year, trade between the two countries totaled $557 billion, the highest on record. And according to the latest figures from the US Census Bureau, there are over 36 million people of Mexican ancestry living in the United States.

Although the number of new Mexican migrants entering the US has plummeted in recent years, Mexico is the main transit country for tens of thousands of Central Americans fleeing even worse levels of violence and poverty.

There is broad consensus that outgoing President Peña Nieto hasn’t done well in managing the relationship with the US under Trump. His decision to invite Trump to Mexico when he was still a candidate was deemed a humiliating disaster.

His management of the NAFTA renegotiations has gone down somewhat better — despite Trump’s repeated threats to withdraw from the free-trade pact, he hasn’t done so yet and talks continue.

Trump was one of the first international leaders to congratulate López Obrador, who has since said he is determined to maintain good relations with the US. “We are not going to get into fights,” he told Mexico’s Televisa TV network on Monday. “We are going to extend our hand honestly in the search of a friendly and respectful cooperation.”

López Obrador added that he would not interfere in the NAFTA negotiations until he takes control of the government on December 1. Then, he hinted, he would seek a more ambitious deal including US aid for rural development in the name of discouraging migration.

It is a bold proposal that sounds hopeless in the current political climate in the US, not unlike another grand idea López Obrador has of establishing a “moral constitution” to provide a country battered by horror and corruption with a guiding light out of the tunnel.

Old friends recall AMLO’s admiration as a student for Salvador Allende, the Chilean president whose “electoral route to socialism” ended with his suicide during a military coup. López Obrador still has a penchant for martyrs to this day: He named his youngest son Jesús Ernesto after Jesus Christ and Ernesto “Che” Guevara.

As he stands on the threshold of power, could AMLO be setting himself up to for his own political martyrdom? Or will his pragmatic talents steer him through?

For now perhaps the clearest indication of his most basic objective lies in a phrase he repeats often, and with obvious feeling: “I have one ambition,” he said again on Sunday night celebrating his victory. “I want to go down in history as a good president of Mexico.”

Jo Tuckman is a freelance journalist based in Mexico. She is the author of Mexico: Democracy Interrupted, published by Yale University Press.

For more on Mexico’s election, listen to the July 2 episode of Today Explained.