THESE days Mexicans agree on two things. Their football team’s victory over Germany on June 17th was magnificent. And the elections on July 1st will be the most important in decades. The front-runner for the presidency, Andrés Manuel López Obrador, leads a coalition called “Juntos haremos historia” (“Together we will make history”). His opponents fear that he will achieve just that, in a bad way.

Mr López Obrador, who has run for the presidency twice before, has a folksy air of incorruptibility that enchants many Mexicans. He promises a “radical revolution”. Some hear that as a threat. Mr López Obrador has at times opposed the measures earlier governments have taken to modernise the economy. His critics liken him to Hugo Chávez, whose “Bolivarian revolution” has brought ruin to Venezuela. The nationalist populism he offers is unlike anything Mexico has seen since the early 1980s. And if the polls are right, he will win.

With that, Latin America’s second-biggest country will join a clutch of democracies where electorates have rebelled against the established order. What is about to happen in Mexico feels akin to the election of Donald Trump in America, Britain’s vote to leave the European Union and Italy’s turn towards populism. It may be repeated in Brazil, where the front-runner to win the presidency in October is Jair Bolsonaro, who speaks viciously about gay people but warmly of military rule.

The causes of popular anger vary. In Latin America, as elsewhere, voters are furious at elites they regard as corrupt, ineffectual and condescending. Just as American populists decry the “swamp” in Washington and Brazilians are aghast at the filth of their political class, Mr López Obrador fulminates against the “mafia of power” that he claims controls Mexico.

A leap into the unknown

The charismatic leaders who ride these resentments to power are almost always false prophets, promising security and prosperity even as they erode their foundations. The danger they pose to new democracies is greater than in more deeply rooted ones. Mr Trump is constrained by Congress, an independent judiciary, a free press and a bureaucracy with a long tradition of following the law. Mr López Obrador, by contrast, will govern a country that has been democratic only since 2000, and where corruption is widespread and growing worse. The next president’s main job should be to reinforce the institutions that underpin a modern economy, democracy and above all the rule of law. The risk with Mr López Obrador, who will be the first non-technocratically minded president in 36 years, is that he will do precisely the opposite (see Briefing).

Mexican technocracy has had its successes. Orthodox economic policies have ensured relatively steady if unspectacular growth since the 1990s. Thanks to the North American Free-Trade Agreement (NAFTA) with the United States and Canada, which took effect in 1994, Mexico is the world’s fourth-biggest exporter of motor vehicles. The outgoing president, Enrique Peña Nieto, opened energy and telecoms to competition and is trying to impose higher standards on a failing school system. Alas, progress has been slower than politicians promised and is uneven. Mexico’s south, where a quarter of the population lives, has ox-drawn ploughs rather than assembly lines. By Mexico’s own measure, nearly 44% of its citizens are poor.

The main source of Mexicans’ discontent is not inequality but crime and corruption, which have run riot under Mr Peña. The murder rate has broken a record set in 2011. The ruling party has seen countless scandals. It emerged that Mr Peña’s wife’s $7m home had belonged to a government contractor. In an ordinary election, Mexicans would ditch Mr Peña’s Institutional Revolutionary Party and turn back to the conservative National Action Party. But after its last crime-ridden years in power, from 2006 to 2012, they are fed up with that, too. They want change, which Mr López Obrador certainly offers.

The firebrand from Tabasco

What sort of change remains to be seen. The biography that beguiles his supporters is replete with danger signals. Time and again he has shown contempt for the law. He has urged people not to pay their electricity bills. After he lost in 2006 his supporters proclaimed him the “legitimate president” and blocked Mexico City’s main street for weeks. He has said that the courts should be an instrument of “popular sentiment”.

His supporters say he has matured, and that his record as Mexico City’s well-liked mayor from 2000 to 2005 shows that he was always pragmatic. He has made his peace with NAFTA and no longer talks of reversing the energy reform. He promises to run a disciplined budget, to respect the independence of the central bank and not to raise taxes. Some of his ideas, like a nationwide apprenticeship programme, make sense.

But he seems to have little idea how a modern economy or democracy works. He disparages independent institutions, such as the supreme court. He talks of making Mexico self-sufficient in food and of building oil refineries, which are unlikely to make business sense. His ideas are simplistic. He wants to halve the salaries of senior officials, including the president, and to subject himself to a recall referendum every two years. Though personally clean, he has formed alliances with politicians who are anything but. He denounces Mr Peña’s education reform, which offers poor children a chance of a brighter future. Yes, Mr López Obrador has reinvented himself, but as a bundle of contradictions.

That makes his presidency a risky experiment. The financial markets might tame a López Obrador government. But a congressional majority for his party might equally encourage radicalism. It might go well if, say, he curbs corruption or stands up to America over trade. More likely, progress will remain elusive. Mexico cannot stop graft without the institutions Mr López Obrador scorns. And with protectionists at the helm in its two biggest member-states, NAFTA could well collapse. That would further poison relations with the United States, possibly imperilling co-operation over drugs and immigration. We worry about Mr López Obrador’s presidency, but wish him luck. If he fails, worse may follow.