Mexican democracy has come a long way from the days when the ruling party would give out washing machines for votes and rip up ballots with the wrong box checked off.

Today, electoral regulators preside over an elaborate system of safeguards that have made stealing the presidency at the ballot box impossible, political analysts say. But they warn that the country’s July 1 election remains vulnerable to subtler forms of tampering and the shadowy influences of organized crime, along with some new twists on the old dirty tricks.

The worst electoral abuses in Mexico during the 20th century were typically the work of its long-ruling political dynasty, the Institutional Revolutionary Party (PRI). With polls showing the PRI cruising toward a big victory this year, election officials here have been making near-daily public assurances that the vote will be squeaky clean.

Top regulators from the independent Federal Electoral Institute (IFE) are eager to avoid a repeat of the last presidential election, in 2006, when leftist candidate Andres Manuel Lopez Obrador cried fraud after losing to Felipe Calderon by less than 0.6 of a percentage point.

Lopez Obrador’s supporters took to the streets and snarled traffic in the capital for months with protests, deepening cynicism among Mexicans who weren’t ready to believe that their democracy had really changed.

Public perceptions of the IFE and Mexico’s electoral integrity have recovered from that crisis, pollsters and analysts say, and this time, all of the major candidates — including Lopez Obrador, who is running again — have pledged to respect the results.

Electoral fraud in Mexico “is a thing of the past,” Leonardo Valdes, Mexico’s top election official, said in an interview.

“You would need a conspiracy among the more than 1 million citizens who have been trained to uphold our electoral laws,” he said.

With suspicions still high — and memories of Mexico’s vote-rigging legacy still raw — regulators have developed some of the most expensive and complex oversight measures in the world.

All of the roughly 80 million registered voters have a sophisticated ID card — doubling as their main form of identification — with a photograph and personal information. Election officials are assigned to voting precincts through a lottery process, and representatives of each political party are invited to observe every stage of the balloting.

Voting more than once

That is not the way things often worked during the 71 years that the PRI ran Mexico, until 2000.

Back then, loyalists could demonstrate their enthusiasm for the party by voting more than once — or more than a dozen times. Unfavorable outcomes could be easily remedied by pen stroke or bonfire. In many small towns and remote corners of rural Mexico, the PRI ran unopposed, and its red-white-and-green logo — matching the colors of the Mexican flag — taught generations of Mexicans to simply refer to it as “the official party,” as if the state and the PRI were one and the same.

Come election time, they often were. In parts of rural Mexico where there were no representatives of rival parties to insist on clean balloting, entire villages would vote to keep the patronage flowing, while PRI-appointed election officials happily certified the results.

The worst practices were curbed by incremental electoral reforms starting in the 1970s, and in 2000 the right-leaning National Action Party (PAN) ended PRI rule with Vicente Fox’s win. The PAN now competes across the country, with the smaller, leftist Democratic Revolutionary Party (PRD) also fielding candidates in many districts.

Today, the parties act as mutual watchdogs, appealing to the electoral institute with complaints or allegations of rivals’ wrongdoing. Although public perceptions of the IFE suffered after the 2006 election crisis, today, about 75 percent of Mexicans have a “positive” or “normal” level of confidence in its integrity, pollster Roy Campos said.

“Unfortunately, voters’ confidence is based on candidates’ fraud claims,” Campos said, suggesting that IFE’s reputation can sink quickly again if controversy returns.

Double-digit lead

It may help this year that the presidential race doesn’t appear as tight as the 2006 contest. Polls show PRI candidate Enrique Peña Nieto with a steady double-digit lead over Lopez Obrador and PAN candidate Josefina Vazquez Mota. Still, Mexican elections often tighten up in the final stretch, and a narrow margin could produce new fraud claims despite candidates’ assurances that they won’t protest the results.

“Mexicans have a tendency to claim an election was unfair if their candidate loses, regardless of party,” said Roderic Camp, a Mexico scholar at Claremont McKenna College in California.

“The real problem is perception,” he said, “and there is a perception that elections are still somehow not fair, even though that may not be true or the number of people who have actually seen fraudulent behavior doesn't correspond to that.

“It’s a legacy of the PRI era.”

Camp and other political observers say that although Mexican regulators have put an end to large-scale cheating, tougher-to-detect forms of tampering and interference persist. So do perceptions that Mexico’s political and media elite are working the levers by other means. A student-led protest movement has staged demonstrations in several Mexican cities and flourished online under the Twitter hashtag #YoSoy132, alleging that the country’s dominant TV networks are in the tank for PRI candidate Peña Nieto.

“If we’re talking about ballots being altered, or not counted, that type of fraud no longer exists in Mexico,” said Mauricio Merino, a scholar at Mexico City’s Center for Economic Research and Teaching. “But some of the practices of the past still continue.”

Incumbents may illegally use public resources to campaign for their parties, Merino said. Other candidates set up slush funds in hidden accounts beyond the reach of regulators, which may draw illegal contributions from legitimate business interests — or drug lords. And patronage networks still apply pressure to voters in some areas where the promise of a reward comes in exchange for support.

Vote buying remains a risk, too. In front-runner Peña Nieto’s state of Mexico, the country’s most populous, a single vote can sell for 1,000 pesos, or about $75, said Silvia Gomez Tagle, a political scientist at the Colegio de Mexico who has written extensively about electoral abuses.

There is also concern that Mexico’s powerful drug gangs could intimidate voters at a local level, depressing turnout with threats of violence through social media or other channels.

But Valdes, Mexico’s top election official, said the agency has not received a single report or complaint about criminal elements attempting to influence the election. Extensive security measures will be deployed July 1, he added.

“We will have everything in place to instill confidence,” Valdes said. “Our citizens will be able to vote.”