Mexico's ruling party appeared to have suffered a series of stinging defeats in the 12 governorships up for grabs in state elections, according to preliminary vote counts Monday.

Hobbled by corruption scandals, violence and a weak economy, the ruling Institutional Revolutionary Party lost four states it has never lost before, including the northern border state of Tamaulipas, across the border from Texas.

The party, known as the PRI, also lost in Veracruz, a state of 8 million that is the third most-populous in the country, and Quintana Roo, home to the resort of Cancun.

Entering Sunday, the PRI held nine of the 12 states up for grabs. According to preliminary vote results, it won only five; the big gains were for the conservative National Action Party, or PAN.

The PAN picked up the border states of Chihuahua and Tamaulipas, and the central states of Aguascalientes and Puebla.

An unusual alliance between the PAN and the leftist Democratic Revolution Party, or PRD, won in the northern state of Durango, Quintana Roo and Veracruz.

"We're back!" crowed PAN national leader Ricardo Anaya Cortes, referring to the party's poor performance since losing the presidency to the PRI in 2012. In a statement, the party called the results "a firm and resounding step toward recovering the presidency in 2018."

The number of states the party controls heading into 2018 will have a significant impact on the amount of resources it has and the number of votes it can muster in the presidential contest.

The PRI lost the presidency in 2000 for the first time in 71 years and won it back in 2012. But President Enrique Pena Nieto is suffering from low approval ratings, intense narco violence in parts of the country and what some see as a lack of commitment to fight corruption.

The PRI appeared to have won five of the governorships, in Sinaloa, Hidalgo, Tlaxcala, Zacatecas and Oaxaca. However, they weren't resounding victories. In three of the five states, the PRI won with only 30 or 40 percent of the vote.

The PRD was the biggest loser, winning no states outright, while the young, upstart Morena party made a healthy start, gaining votes but winning no governorships.

Anaya proclaimed it an historic night for the PAN, which previously had never won more than three governorships in one election.

Government and political leaders reported scattered incidents of election-related violence.

Voters were also deciding local races in Baja California. And in Mexico City, voters were selecting 60 members of a constituent assembly who will write a constitution for the capital.

___

Stevenson reported from Mexico City.