Like a Dos Equis ad, Mexico is “keeping it interesante.” On July 1, Andres Manuel Lopez Obrador, the veteran left-wing politician known as AMLO, will likely win Mexico’s presidential election, to the horror of policy analysts, U.S. government officials, and the Mexican business community. As head of the upstart National Regeneration Movement (MORENA, the Spanish acronym, also means “dark skin”), AMLO pledges to make Mexico self-sufficient on food, halt foreign investment in the oil industry, and grant amnesty to drug traffickers. AMLO hates the North American Free Trade Agreement (NAFTA)—although he’s promised to stay in it for now—and “the Wall” even more.

Washington’s days of having a predictable and compliant partner in Mexico may be over.

This election is likely to radically transform Mexican politics. MORENA is surging in the polls and may give AMLO a strong legislative bloc. Nationalist-minded legislators from other parties could also defect to his agenda. That would cause a major Mexican political realignment, under which for the next six years it could be governed by a self-described “revolutionary nationalist” ruling coalition. It makes sense: Mexico’s neoliberal era had to end sooner or later. AMLO’s longtime critique of an unfair economy and a complacent and unresponsive political system has finally resonated.

What accounts for this sudden turnaround? Several factors have aligned in AMLO’s favor. Start with AMLO’s opponents, who, in a time of change, represent continuity, splitting the neoliberal vote in Mexico’s “winner-take-all” system. The conservative National Action Party (PAN), his strongest competitor, diluted its solid brand by running in coalition with two leftist parties. The ruling Institutional Revolutionary Party (PRI) selected a well-qualified former finance minister who is out of his depth as a campaigner. That’s left the once-powerful PRI mailing this campaign in, and AMLO siphoning up its traditional voters.

Insecurity and corruption, according to polls, are the top issues for Mexican voters, and on these AMLO scores well. Especially on managing corruption and crime, Mexico’s political elite have appeared notoriously inept. The former head of the state oil company PEMEX, a close ally of President Enrique Peña Nieto, has been credibly accused of taking up to $10 million in bribes to approve contracts from the corrupt Brazilian construction company Odebrecht. Several governors have been indicted for racketeering and graft; one even went on the lam and was arrested in Guatemala. Recently, Mexico’s 12-year campaign to corral drug trafficking organizations fell apart, and violence skyrocketed. Twenty-eight thousand Mexicans were murdered last year, and political candidates are being physically attacked. Meanwhile, drug trafficking gangs (“cartels”) are placing parts of the country off limits.

Then there’s President Trump, who has treated Mexico as a problem and not as a partner by insisting that it fund his humiliating border wall. When asked in 2015 by Wall Street Journal editors if he thought the U.S. should promote stability and economic growth in Mexico, he replied, “I don’t care about Mexico honestly. I really don’t care about Mexico.” Trump has bolstered AMLO’s long-held view that Mexico has relied on the United States for too long. On the campaign trail, AMLO has vowed to put Trump “in his place.”

Still, these more immediate causes don’t entirely explain AMLO’s impending success. At a deeper level, AMLO seems to be Mexico’s answer to Samuel Huntington’s key “who are we?” question on national identity. AMLO’s MORENA explicitly seeks to revive the abandoned ideals of the Mexican Revolution (1910-1920): anti-imperialism, defense of national resources, equality, and the protection of peasant rights. Tellingly, AMLO cites as his heroes two successful presidents who propelled Mexico forward: Benito Juarez, the black-clad Zapotec Indian who defeated the French-backed 19th-century “empire,” and Lazaro Cardenas, the former revolutionary general who nationalized the oil industry and built the modern Mexican state.

Despite his populism, AMLO hasn’t always been an outsider. He started his political career during the 1980s, when the PRI was still was Mexico’s governing party. But he soon saw the changes happening in his rural native state of Tabasco, when the oil boom pushed out the farming and fishing industry. AMLO dissented from the PRI’s decision to liberalize the economy and joined the opposition in 1988.

Led by Carlos Salinas de Gortari, who was president from 1988 to 1994, the country embarked on a strict neoliberal development path and internationalist agenda, reversing its program of statist economics and authoritarian governance. Its ruling politicians sold state industries, embraced market reforms, let the peso float, and joined the North American Free Trade Agreement. Over the last several years, Mexico City has even permitted greater American involvement in its war against drug traffickers. Under Peña Nieto, Mexico finally allowed its oil industry to permit foreign investment.

In truth, these reforms worked well enough: Mexico democratized and developed into a solidly middle-income country with steady economic growth. Net immigration into the United States has come to a halt. Security issues were messy, but unlikely to destabilize the country.

These reforms represented a big win for Washington. If American intervention was needed for the occasional peso crisis or drug trafficker menace, we were happy to oblige. Mexico made a difficult partner at times, but on the policy side, it was where Washington wanted it to be.

But the cost of these changes may have been Mexico’s identity, its sense of self. Returning to Huntington, his “The Clash of Civilizations?” article described Mexico as a state “torn” between its economic future and political and cultural past. After a top advisor to President Salinas described the sweeping changes the government was making, Huntington remarked, “It seems to me that basically you want to change Mexico from a Latin American country into a North American country.” Salinas looked at him with surprise and exclaimed: “Exactly! That’s precisely what we are trying to do, but of course we could never say so publicly.”

AMLO and his followers have brooded about these radical changes for years. To this day, he refers to the arch-neoliberal Salinas simply as El Innombrable—he that cannot be named. Neoliberalism launched AMLO not just on a political career but on a personal crusade to bring the country back to its former ideals.

When AMLO won the Mexico City mayorship in 2000, he built up a national political base and became a burr in the saddle of President Vicente Fox, who had embraced the liberal reforms of the formerly ruling PRI. AMLO criticized Fox relentlessly, and in retaliation, Fox attempted to have him legally prohibited from running for president in 2006.

This clumsy effort failed, giving AMLO a boost. But he narrowly lost the contest to the PAN’s Felipe Calderon, whose campaign linked AMLO with Venezuela’s leftist President Hugo Chavez. Embittered in defeat, AMLO immediately claimed the voting was rigged against him. AMLO and his raucous followers held protests for months and even formed a parallel government. He may have lost in 2006, but he solidified his position as the leader of Mexico’s alternative left.

AMLO’s anti-system stance has given weight to the claim that he’d be another Chavez. The comparison seems invidious, as the late comandante of Venezuela, an avowed Marxist and coup plotter, crushed democratic institutions, set up a socialist economy, and in general drove what had been a prosperous South American country into the ground. AMLO, an authentic democrat, appears less megalomaniacal and more rules-focused, more the romantic reactionary than the revolutionary radical.

Still, many of the same forces that propelled Chavez are driving AMLO now. Like Chavez, AMLO is coming to power after a period of neoliberal reform and perceived intractable corruption. Like Chavez, AMLO enjoys an almost mystical bond with his nation’s poorer classes. And very much like Chavez, AMLO is instinctively, but probably not irreversibly, anti-American in outlook.

How these characteristics will play out with AMLO in power is hard to predict. The two main parties won’t be behind him, but many of their followers might. All of those alienated by neoliberalism, the perceived kowtowing to Washington, the surrender of economic resources to foreign companies and the free market, will flock to his banner. It is remarkable how some former members of the right-of-center National Action Party and the PRI have backed his campaign.

Some of AMLO’s policy proposals seem less the stuff of hard leftism than nostalgic nationalism. He focuses heavily on national development for industry and agriculture aimed at self-reliance and reducing imports. He proposes holding referendums on the enacted legislation, a move to broaden democracy, which would require constitutional reform. He seeks to raise the minimum wage, but refreshingly pledges “no new taxes.”

AMLO loves to wax nostalgic about Mexico’s strong state traditions and will almost certainly attempt to restore the waning power of the Mexican presidency as an anti-corruption pulpit. In the tradition of newly inaugurated Mexican presidents, he’ll probably look to prosecute a node of corruption in Mexican society: a prominent businessman or politician, rather than a labor union like his predecessors.

Much of the progress the United States has made with Mexico on security cooperation will probably be jeopardized. It’s hard to believe that AMLO will endorse the close relations that the DEA, the Pentagon, and the intelligence community have forged with their Mexican counterparts in the war on drugs. The extradition of the notorious drug kingpin Joaquin el Chapo Guzman to the U.S. in 2017 will probably be the high watermark in the relationship. It is doubtful that AMLO will permit more high-profile extraditions. President Trump’s disdain for a close relationship that has taken us decades to build may come back to haunt us.

But a poor relationship between Washington and Mexico City doesn’t have to be inevitable. Despite the rhetoric, the flamboyant American billionaire has much in common with the austere Mexican populist. Both countries have too many common interests to go down separate paths. The question is: does AMLO have to build the bomb to get Trump to care about Mexico?

Michael J. Ard is a former deputy national intelligence officer for the Western Hemisphere and the author of An Eternal Struggle: The Role of the National Action Party in Mexico’s Democratic Transition. He teaches international relations at Rice University’s Master of Global Affairs program.