MEXICO CITY (Reuters) - Mexico’s ruling party may have won a bruising electoral battle with its leftist arch-enemy at the weekend, but the narrow victory showed how momentum has swung behind him in the run-up to next year’s presidential race.

Police officers walk on the main square a day after local election in Toluca, Mexico June 5, 2017. REUTERS/Carlos Jasso

Veteran campaigner Andres Manuel Lopez Obrador has led early polls for the 2018 vote, and his new National Regeneration Movement (MORENA) came close to seizing the main bastion of President Enrique Pena Nieto’s Institutional Revolutionary Party (PRI) in Sunday’s gubernatorial vote in the State of Mexico.

Fielding a little-known former school teacher as candidate, the three-year-old MORENA picked up more votes than the other two main opposition parties combined to lift Lopez Obrador’s hopes of making it third time lucky in his bid for Mexico’s top job.

“We feel strengthened,” Lopez Obrador, who finished in second place in the 2006 and 2012 elections, said on Monday in a video in which he disputed the results of Sunday’s vote. “Because MORENA is the party that’s growing fastest.”

A Lopez Obrador win in 2018 could pitch Mexico onto a more nationalist pathway at a time of diplomatic strains with the United States under President Donald Trump, who has threatened to impose protectionist measures on Mexican industry and stirred up anger with outspoken comments about Mexican migrants.

Though preliminary results showed the PRI victorious in the state, the party’s support base was shattered by MORENA’s emergence. The PRI’s vote share slipped from more than 60 percent in 2011 to just 33.7 percent, while MORENA was projected to win 30.9 percent.

The center-right National Action Party (PAN), which ruled Mexico from 2000 to 2012, picked up just 11.3 percent of the vote, while the center-left Party of the Democratic Revolution (PRD), a group Lopez Obrador once led, won 17.8 percent.

The results showed the vast majority of voters in Mexico’s most populous state wanted the PRI out - but the three-way division of the opposition vote enabled the centrist party to retain control of a state it has governed since 1929.

As united as Mexico’s opposition is in wanting to be rid of the PRI, it remains deeply divided about how to achieve this - in significant part due to Lopez Obrador’s tendency to condemn those who do not support him as stooges of the PRI.

Lopez Obrador came within a whisker of taking the presidency in 2006, but public support for him fell away after he denounced the result and caused weeks of chaos in Mexico City with street protests, claiming he had been robbed by his PAN opponent.

The 63-year-old has toured the country ever since, relentlessly denouncing opponents as corrupt gangsters, while gradually moderating the tone of his policy rhetoric.

Slideshow ( 3 images )

Pledging to do more for the poor and make big savings ending corruption, Lopez Obrador vows to consult the public on whether to unwind a 2013 energy reform, and markets have shown signs of nervousness at the prospect of him taking office.

The PRI has sought to exploit Lopez Obrador’s difficulty to play nicely, and senior party officials have told Reuters privately that one of its best hopes of retaining power rests with keeping the opposition divided.

The PAN and PRD have joined forces to beat the PRI several times and another tie-up between the two parties in the western state of Nayarit helped defeat the PRI there on Sunday.

Nayarit was one of two other governorships up for grabs, and critics of Lopez Obrador noted on Monday that MORENA was unable to mount a serious challenge alone in either of those races.

A PROBLEM FORGING ALLIANCES

The party leaders of the PAN and PRD last month floated the possibility of a national alliance for the July 2018 vote, prompting scorn from Lopez Obrador - though it did not stop him courting PRD support in the State of Mexico election.

Having previously run as the PRD candidate for the presidency, Lopez Obrador is seeking to absorb the left’s vote. Still, MORENA secretary general Yeidkcol Polevnsky admitted ongoing divisions in the opposition were hurting efforts to defeat the PRI.

“It’s everyone’s problem,” she said, arguing MORENA would have won easily with PRD backing in the State of Mexico.

But there is skepticism in PRD ranks as to whether the former mayor of Mexico City is interested in a formal tie-up after splitting acrimoniously with the party to found MORENA.

“The big lesson of (Sunday’s) election is clearly that you can’t win without forging alliances,” said Agustin Basave, a former PRD chairman. “I’d like an alliance of all the opposition to make sure the PRI is ousted in 2018. (Lopez Obrador) seems to want a de facto alliance where the voters and supporters of the left - beyond their (party) leaders - vote for him.”

In the end, voters may have the final word.

After the State of Mexico election, some PRD supporters were already thinking of backing Lopez Obrador next year.

“If MORENA rocked the State of Mexico and almost won, (Lopez Obrador) is a very strong candidate for the presidency now,” said Luis Diaz, a 19-year-old PRD voter in the state.