MEXICO CITY — Both sides claimed victory Monday in the election for governor of the key Mexican border state of Baja California and authorities said mistakes had been made in preliminary vote counts.

Elections were also held Sunday for state legislators and mayorships in 13 other states. The campaign was so scarred by violence that some analysts feared it was becoming endemic in local Mexican politics.

Preliminary results from the Baja race with about 97 percent of the vote counted showed Francisco “Kiko” Vega of the conservative National Action Party with a nearly 3 percentage point lead, suggesting his coalition might be able to hold onto the governorship his party first won 24 years ago, the first recognized opposition victory in Mexico’s modern history.

But the state electoral council announced early Monday that mistakes had been made in the preliminary vote counts.

“Because of the technical errors that occurred, it should not be considered reliable,” said council spokeswoman Helga Casanova. The more thorough official count will begin Wednesday and conclude Sunday.

Vega, who ran in a coalition with the Democratic Revolution Party, claimed victory.

But so did Fernando Castro Trenti of the ruling Institutional Revolutionary Party, which held the presidency from 1929 to 2000. The party known as the PRI was seeking to capitalize on the momentum of its return to the presidency in 2012 after 12 years out of power.

The unsettled elections — marked by low turnout, the vote-count dispute and accusations of dirty tricks — raised doubts about the fate of a national united front, known as the Pact for Mexico, in which all of Mexico’s major parties have cooperated to pass important reform bills.

National Action said a series of dirty tricks in Baja and other state races marked a return to old strong-arm tactics that helped the PRI hold power for seven decades.

Party leader Gustavo Madero had been cooperating with the PRI and President Enrique Pena Nieto to enact key national reforms in public education and telecom laws, and on upcoming energy and tax reform. But he suggested that could be at an end.

“We are seeing two realities. The Pact for Mexico is very civilized, very advanced policy, but on the other hand, when there are elections, it’s back to acting like the 1970s or 80s,” Madero said, referring to an era when the PRI ruled through vote fraud and handouts.

PRI leader Cesar Camacho brushed off criticisms, saying the voting in most states appeared to be fair. He alleged that some voters were being intimidated in National Action-led Baja California and that someone had thrown a gasoline bomb at the home of a PRI municipal candidate.

Baja California faces significant problems of crime, the influx of immigrants from other states, explosive growth and the pressure of dealing with tens of thousands of migrants deported from the United States each year. While violence in Tijuana has calmed from high levels several years ago, methamphetamine and other drugs have continued flowing to neighboring California after the Sinaloa cartel gained the upper hand in a turf war.

The weeks leading up to Sunday’s vote were marked by a spate of shootings and attacks in other states. At least eight politicians running for local posts, or their family members were killed. Others reported being kidnapped or shot at.

A ninth death came Friday. Aquiles Gonzalez, a campaign coordinator for Democratic Revolution in the northern state of Zacatecas, was found stabbed to death after apparently having been kidnapped.

A young political activist was shot to death Sunday in the Gulf coast state of Veracruz and Camacho claimed that he was a PRI supporter.

The causes of most of the attacks are still uncertain. Some fear that drug gangs are asserting their power. Others fear that candidates are being targeted by their rivals.

“There is starting to be violence every time there are elections, especially local elections,” said Jose Antonio Crespo, a historian at the Center for Economic Research and Teaching in Mexico City. “There is more violence in local elections, because that is where the drug cartels have more influence than on a national level.”

In the local races, the PRI appeared to be winning the mayorship of the border city of Tijuana, while National Action was ahead in Mexicali, the Baja California state capital. Further east along the border, National Action was ahead in the cities of Nuevo Laredo and Matamoros.

To the south, National Action led in the colonial city of Oaxaca, while the PRI claimed to have won the mayorship of the resort city of Cancun.

In the Veracruz state capital of Xalapa, Morris — a cat whose owners ran him as a write-in candidate for mayor to illustrate their disgust with the country’s politicians — may have won several thousand votes. While electoral authorities simply list write-in votes in a column labeled “unregistered,” and don’t break down who they were for, there were about 3,000 votes in the column by early Monday. That was about 3.5 percent of the votes counted up to this point in the mayoral race. No other city in the state showed anywhere near that level of unregistered votes.

However, the cat’s campaign managers — his owners — said in a statement that his real number of votes may have been 8 percent or more of the total, because many precincts also appear to have listed votes for the cat as “void,” a column that included about 4,600 votes, rather than “unregistered.”

Hundreds of voters sent photos of their ballots to the cat’s web site, showing their voting cards marked “Morris” and “Morris The Cat.”