WITH its roving vendors of pork-scratchings and its stucco and ochre cathedral, Atlacomulco looks like a typical Mexican town. Its politics follow the traditional Mexican model too: plaques commemorate the good works of former governors, who all belonged to the same party and in some cases share the same surname. The newest notices hail the achievements of Enrique Peña Nieto (pictured), who completed his term as governor of Mexico state last year, the fifth man from his extended family to do so.

For seven decades this was the story of Mexico. Power remained within the Institutional Revolutionary Party (PRI), and within what its founder, Plutarco Elías Calles, called the “revolutionary family”. Less blood was spilled on the road to democracy than in many Latin American countries, but it was a longer slog. Until 1989 the PRI ran all of the country's 31 states. It was another eight years before it gave up its majority in Congress. Only in 2000 was it finally prised out of Los Pinos, Mexico's presidential residence.

Now it is poised to take it back. Polls suggest that Mr Peña, the man from Atlacomulco whose fresh face belies deep roots in the old networks of power, leads his rivals in the presidential election on July 1st by more than ten percentage points. The party has a chance of winning a majority in the Senate—though probably not in the lower house of Congress—and of gaining two more governorships (it already controls two-thirds of the states).

The PRI's campaign has been years in the making. Losing the presidency in 2000 left it without a leader, which caused fatal infighting. The party finished a distant third in the 2006 election. It learned its lesson and has closed ranks around Mr Peña with no visible ripple of dissent. The launching pad for his candidacy was his governorship of Mexico state, which with 15m inhabitants is nearly as populous as Chile and has a budget of 166 billion pesos ($12 billion). His government there was “conceived as a showcase for his presidential campaign,” says Luis Rubio of CIDAC, a Mexico City think-tank. His presidential run has mimicked his gubernatorial campaign, the candidate signing promises before a notary to complete small but visible projects: a motorway in Michoacán, storm drains in Tamaulipas and so on. Its organisation has been “spectacular”, admits an adviser to a rival candidate.

Out of the frying PAN

Mr Peña is no intellectual, and was dismissed by many as a lightweight. But he has proved himself to be an astute politician with staying power. This year he wobbled only once, when heckled at Mexico City's Iberoamerican University on May 11th. He fled, dismissing the students as stooges of his left-wing opponent, Andrés Manuel López Obrador. Some were, but many were not. Big marches against Mr Peña and his ties to Televisa, Mexico's dominant broadcaster, followed. Talk of an Arab-style “Mexican spring” is overblown, but the loud, articulate movement may remain a cactus-spine in Mr Peña's side, whether he wins or not.

If the PRI has managed to win its way back into Mexican hearts, that is partly a verdict on its opponents. Since 2000 Mexico has been governed by the conservative National Action Party (PAN), first under Vicente Fox, a genial campaigner but poor political manager, and then under Felipe Calderón, a career politician whose father was a founding member of the party. Lacking a majority in Congress, both PAN presidents proved unable or unwilling to forge the alliances needed to recast a political system ill-equipped for a multiparty democracy, and an economy restrained by public monopolies (of energy) and private oligopolies (telecoms, television, beer and cement, for example).

Instead, Mexico has moved forward in modest steps. Mr Calderón broadened access to health care, improved infrastructure and took some measures to boost competition. He also tried to improve education, only to be thwarted by the mighty teachers' union. He could have achieved more had he set aside his visceral dislike of the PRI, which in return saw little reason to help him. So economic growth was moderate. It was set back first by competition from China after it joined the World Trade Organisation in 2001, and then by the implosion of America's banks. Mr Calderón will be recalled most for donning a military uniform and sending the army to confront organised crime. That was, in part, a way to assert his authority, denied by Mr López Obrador, whom he defeated by less than 1% of the vote in 2006. For the first year the crackdown seemed to work. But then turf wars between rival “cartels” made places such as Ciudad Juárez, on the Texan border, among the most violent in the world. In four years the murder rate doubled. Last year saw 596 beheadings. The press has spread images of victims, purple-faced from hanging, missing hands and tongues, messages carved into chests. By no means all of the estimated 60,000 dead were criminals, as the government at first claimed. Mr Calderón compares himself to a surgeon who goes to remove a tumour and finds the cancer has spread around the body. He insists that the surgery was necessary; aides point to Central America, where the unchecked malaise has generated a murder rate up to four times higher than Mexico's. The government is trying to nab its most wanted man, Joaquín El Chapo Guzmán, before the election. In February he narrowly escaped in Los Cabos (the resort which this week hosted the G20's leaders). This month a lieutenant, Juan José Esparragoza, slipped away from a girl's 15th birthday party just before the Black Hawk helicopters arrived. His critics argue that Mr Calderón launched a war while lacking both the tools and a strategy with which to win it. He did create the nucleus of a federal police force (now 36,000 strong), but it was slow going. Perhaps his biggest victory is that the three main presidential candidates all advocate continuing the struggle. None has set a deadline for withdrawing the troops. The PAN's Josefina Vázquez Mota would triple the federal police. Mr Peña would set up a paramilitary gendarmerie of 40,000, recruited from the army. He has hired Óscar Naranjo, who this month retired as Colombia's police chief, as an adviser, and said that spending on security, which has nearly doubled under Mr Calderón, should triple again, to approach Colombian levels of over 5% of GDP.

Old tequila in new bottles

But the immediate effect of the drug war is that many Mexicans feel unsafe. Mr Calderón's approval rating is lower even than those of the last PRI presidents at the end of their terms. A poll last year found that the proportion who thought the country was “on the wrong track” was the highest in a decade. This has frustrated Ms Vázquez, who seemingly cannot decide whether to highlight her predecessors' achievements or distance herself from their shortcomings. A minister under both Mr Calderón and Mr Fox, she bills herself as “different”. Beyond her sex she has struggled to explain how. Recently she has portrayed herself as the real alternative to the PRI, to which Mr López Obrador once belonged. Whereas both her rivals are in bed with broadcasters and unions, Ms Vázquez would run “a government of citizens, not hostage to interest groups,” says Miguel Székely, her policy adviser.

In many recent polls, Ms Vázquez has been overhauled by Mr López Obrador. He never accepted his narrow, but clear, defeat in 2006. After the election he bused in supporters to block Mexico City's main avenue for months, and then spent years visiting each of the country's 2,456 municipalities to introduce himself as the “legitimate president”. His leftish Party of the Democratic Revolution (PRD) is the natural choice for those who are sick of the government and mistrust the PRI. But the magnetic Mr López Obrador repels as many people as he attracts. He also helped to thwart attempts to unite the anti-PRI vote. In 2010 and 2011 the PAN and PRD joined forces to oust PRI governors in Guerrero, Oaxaca and Puebla, which had never before changed hands. A similar pact was planned in Mexico state, to deny Mr Peña a smooth handover. An alliance for the presidency might have followed. But it was derailed by Mr López Obrador, who knew he could not win the PAN's support for his candidacy. Mr López Obrador has appointed moderates such as Marcelo Ebrard, the popular mayor of Mexico City, and Juan Ramón de la Fuente, a former rector of the National Autonomous University, to his putative governing team. He highlights the stable crime rate in the capital, of which he was mayor between 2000 and 2005. The poor like his promise of jobs and the intelligentsia applauds the PRD's backing for abortion and gay marriage. His actions in 2006 weigh heavily against Mr López Obrador. In his television spots, citizens reminisce about the worst examples of PRI and PAN misrule, and ask if the blockade of Paseo de la Reforma was such a big deal by comparison. But fears persist that the man who once declared, “To the devil with the institutions,” will dispute the outcome again. On June 5th he warned that his adversaries would resort to fraud. In March he said that victory for the PAN or PRI was “morally impossible”.

Browse our <a title= slideshow guideto the leading

candidates for the Mexican presidency" src="https://www.economist.com/sites/default/files/images/2012/03/articles/body/20120331_wop930_290.jpg" srcset="https://www.economist.com/sites/default/files/images/2012/03/articles/body/20120331_wop930_290.jpg 1x" width="290" height="163" alt="" data-slim="1" data-teg-id="pls6iv86jmu0h2hulggsqo9hf265i3c8">

To the PRI's critics, 12 years in the wilderness seems too short to atone for decades of authoritarianism. Some talk of a “Putin” scenario, in which the party's old guard neuter democracy and stifle the press—and even make deals with drug traffickers. The PRI's “dinosaurs”, as its old guard are known, are not extinct. In conveniently timed investigations, federal prosecutors have recently accused several PRI leaders of serious crimes. Tomás Yarrington, a former governor of the border state of Tamaulipas, is accused of taking bribes from drug traffickers. Humberto Moreira resigned as the party's president last year over a debt scandal. Both men deny wrongdoing.

Atlacomulco is a Jurassic Park of dinosaurs. Mr Peña's predecessor, Arturo Montiel, dropped a bid for the presidency in 2005 when details emerged of an unexplained property empire. Carlos Hank González, the founder of the Atlacomulco clan, used to say, “A politician who is poor is a poor politician.” His son Jorge Hank Rhon, who has 19 children, was arrested last year when soldiers found 88 firearms in his home in Tijuana. Two were linked to murders but he was freed because the soldiers lacked a warrant. American authorities said in 1999 that the Hank family ran a “multi-billion-dollar criminal and business empire”. They deny this.

Josefina struggles to define the difference Mr Peña's aides stress that dinosaurs would not get their claws on power if he won. “The presidency is not a collegial body…He will surround himself with people who share his vision,” says Luis Videgaray, an MIT-trained economist who was Mr Peña's finance secretary in Mexico state and is tipped as his chief of staff. Mr Peña has made some clever appointments: many had expected him to nominate his cousin, Alfredo del Mazo, as his successor in Mexico state, but he opted for Eruviel Ávila, a popular working-class mayor, who duly won a thumping victory. On paper Mexico state is more politically plural than “Putin” gibes imply. Its legislature is split between the three main parties; most big towns are run by opposition mayors. But the opposition is not particularly feisty. Under Mr Peña, the state budget was passed unanimously six years running. “The PRI knows how to negotiate,” says Martha Nateras of the local Autonomous University, who suspects that deputies are kept in line with handouts of cement or roofs, to distribute to constituents. Article 19, a free-speech pressure group, says that Mexico state spends less per person on official publicity than do 15 of the 17 other states that provide such information. It gives the state high marks for transparency. (By contrast Mexico City provided few figures when Mr López Obrador was in office there.) But few believe this is the full picture. Omar Rábago of Article 19 says that local media in most states, including Mexico state, admit providing favourable coverage in return for backhanders. Mr Peña has denied such antics. But his government certainly faced little journalistic scrutiny. When he claimed in his final report as governor that the murder rate had fallen by more than half during his term, the boast was parroted by local media. When The Economist pointed out that the rate had in fact risen, Mr Peña acknowledged the error. But what other whoppers went unquestioned?

The PRI's candidate has received supportive coverage from Televisa, which has 70% of viewers in Mexico's stifled television market. In 2010 Mr Peña married Angélica Rivera, star of Televisa telenovelas such as “Distilling Love”, a melodrama about passion in the agave fields. He is close to Pedro Aspe, the finance minister during Carlos Salinas's presidency (1988-94) and later Mr Videgaray's boss at Protego, a financial-services firm. Mr Aspe is the co-chairman of Televisa's board. Unverified documents published in the press claim to show payments to Televisa by Mexico state for positive coverage. Both sides say the contracts are fake or were for legitimate advertising.

López Obrador, the messiah The media are slowly becoming more dinosaur-proof. A third free-to-air TV channel is on the way, after Televisa's chief executive gave his lordly consent in a Wall Street Journal column in May. Digital convergence means that Carlos Slim, Mexico's telecoms whale, is nosing into the market. The courts struck down a law that would have allowed television concessionaires to extend their licences indefinitely. The electoral authority checks that candidates get equal airtime during the campaign (monitoring the tone of coverage is harder). A freedom-of-information law helps investigative reporting. Even Televisa eventually covered the anti-PRI student protests. Democratic institutions are also stronger than the PRI left them in 2000. “I don't know if the PRI has changed, but the country has changed and the world has changed,” says Jorge Castañeda, a foreign minister under Mr Fox. Power has drained from the presidency to the governors, who control about a third of public spending. They also wield influence in Congress. Will the PRI's legislators answer to the president or to their local governor? Certainly Mr Peña would not have the power of Mr Salinas, who dismissed 17 governors during his six years in office. The PRI would also need political cover to pass unpopular measures, such as a tax reform, whether it had a majority or not. Most big reforms need constitutional amendments, and thus a two-thirds majority, as do appointments to the Supreme Court (by the Senate). And many of Mexico's most important commitments are international ones: 80% of exports go to the United States via the North American Free-Trade Agreement, which has restricted presidents' room for manoeuvre since before the democratic era. From revolution to consensus

Mexico's next president will not enter Los Pinos until December 1st. The five-month handover period is likely to be busy. The outgoing Congress could approve a labour reform, says Mr Videgaray. This is likely to include speeded-up tribunal hearings and temporary contracts.

The new Congress takes office on September 1st. A senior PRI source in the legislature says that before December the party will aim to pass a fiscal reform to broaden value-added tax. He also favours a political reform that would restore a modicum of power to the presidency. The president would be able to require Congress to consider three presidential proposals per six-month session.

This bill would also regulate the use of the presidential veto, and allow the president to order the Supreme Court to speed up important cases (a way of limiting the impact of injunctions, which vested interests have used to block reforms). But Mr Peña is opposed to two measures which many political analysts see as essential to make Mexican democracy more accountable and effective: allowing legislators to stand for consecutive terms, and introducing a presidential run-off.

PRI sources say they would also hope to approve before December an energy reform, to open Pemex, the public oil and gas monopoly, to competition. It will be “a second expropriation of oil, this time from the hands of the finance minister,” the legislator says, adding that by the end of the presidency a tenth of production could be in private hands. Private investment would be allowed in shale gas and oil, refining and petrochemicals. The reform might also allow Pemex to offer risk contracts for offshore oil. The subsidy on petrol would be eliminated, its abolition to be accompanied by a new fund for public transport.

Such plans generate enthusiasm overseas. “I suspect that we are on the eve of the most promising opportunity the country has seen in more than a decade,” wrote Gray Newman in a note for Morgan Stanley. There is still scepticism that the PRI will keep its promises. The head of the truculent oil-workers' union, Carlos Romero Deschamps, is a PRI candidate for the Senate. Mr Videgaray says that Mr Romero is in favour of the energy reform and that the union could be a “great ally” in passing it. The union boss is doubtless aware that a predecessor of his was jailed by Mr Salinas when he proved obstructive.

The PRI may find allies in the PAN, which could extract political reforms in return for approving economic ones, says Juan Pardinas of IMCO, a think-tank. Negotiations could be smoothed by the fact that Mr Calderón will need help from the next president if he faces charges for drug-war crimes. Ernesto Zedillo, the former president who finally brought democracy to Mexico, faces civil charges in America over claims—which he denies—of foreknowledge of a massacre by PRI paramilitaries in 1997. Mr Calderón is watching the case closely.

Beneath the campaign rhetoric there are large overlaps of opinion on Mexico's future course. All candidates want fewer tax breaks, more competition in the private sector, a stronger national police force and evaluation of teachers. The PRI and PAN both want a more flexible labour market and to open the energy sector to competition. “We may finally have arrived at a new national agreement that is qualitatively different from revolutionary nationalism,” says Héctor Aguilar Camín, a historian. When the dust settles on July 2nd, Mexico's old and new guards may find they have more in common than they think.