ENRIQUE PEÑA NIETO, the candidate of the Institutional Revolutionary Party (PRI), is on course to become the next president of Mexico. An official “rapid count” of ballots just before midnight following Sunday's election gave him a projected lead of between 6% and 7.7% over his closest rival. Felipe Calderón, the outgoing president (and member of the rival National Action Party, or PAN), congratulated Mr Peña on his victory late on Sunday evening, and the PAN's candidate, Josefina Vázquez Mota, conceded. But Mr Peña's closest challenger, the left-wing Andrés Manuel López Obrador, said he would wait for the final results, which are expected on Monday evening. Nearly all pollsters had expected Mr Peña to win. The projected result however is closer than most predicted. Surveys had given Mr Peña a lead of between ten and 15 percentage points. If the projected results of the presidential race are mirrored in the congressional elections, which was held on the same day, the PRI is likely to be the biggest party in both houses. Still it may fall short of the absolute majority for which it had hoped. A complicated voting system, involving elements of first-past-the-post and proportional representation, means that the composition of the legislature will not be known until late on Monday. The return of the PRI is not welcomed by everyone. The party ran Mexico for seven uninterrupted decades until it was ousted from the presidency in 2000. Back then few expected that the “perfect dictatorship”, as the PRI regime was dubbed by the Peruvian novelist Mario Vargas Llosa, would return to power just 12 years later. But the television-friendly Mr Peña ran a professional campaign and faced weak opposition from the fiery Mr López Obrador and from Ms Vázquez, whose poor result is in part a verdict on Mr Calderón's disappointing six-year term in office. Many have predicted that a close result would lead to a challenge by Mr López Obrador, who lost the 2006 election by less than 1% and mounted a months-long blockade of Mexico City's main thoroughfare to protest that result, which he claimed (with thin evidence) was fraudulent. This year's race looks to be nothing like as close as that of 2006. But if Monday's final results show a narrower gap, Mr López Obrador's committed followers could yet take to the streets again.

Election day provided some ammunition for a challenge, with evidence of cheating by some parties and cock-ups by the electoral authorities—though the scale of both was unclear. There were reports of voters in poor areas being offered upwards of 500 pesos ($38) to hand over their voting cards, which prevented them from casting their votes and perhaps enabled someone else to cast them instead. The PRI featured most often in such reports. A ban on political advertising after the end of the campaign on Wednesday was flouted by the Green Party, a formal ally of the PRI. The Greens illegally sent text-messages and recorded phone calls to many people (including your correspondent) on the day of the election, urging them to vote for their candidates.

Others were disenfranchised by poor planning on the part of the election authorities. Some polling stations ran out of ballot papers. The problem was acute in Mexico City, where I spoke to Óscar Villanueva, a 23-year-old employee of the federal police who had hoped to vote in a presidential election for the first time. Mr Villanueva had to leave his home constituency to go to work before the polls opened at 8am, and would not return before they shut at 6pm. Special polling stations in the city centre were set up for the thousands of people in his position. But each was stocked with only 750 ballots. All had run out by the time Mr Villanueva went to vote at lunchtime. “One vote could make the difference,” he said, hurrying off in search of a better-stocked station. Disenfranchised voters protested outside the electoral authorities into the night. Some desperately chalked up their votes on makeshift tally-sheets outside polling stations.

Despite these dispiriting events, turnout was 62%, slightly higher than in the previous presidential election. So far it seems unlikely that the instances of cheating and administrative botches were widespread enough to swing the result by the roughly 7% by which Mr Peña is believed to have won. If Monday brings more evidence of irregularities, if the final vote count is closer and if Mr López Obrador has the energy for a fight, Mexicans might be in for a long July. But it seems all but certain that December 1st will see the inauguration of Mr Peña, and the return to power of the PRI.

(Picture credit: AFP)