The Mexican state of Tamaulipas has dismissed its head of security following the discovery of 145 bodies in mass graves earlier this month.
The state governor said the new chief would improve coordination with the army and federal police in the fight against drugs gangs.
The killings have been blamed on the Zetas drug cartel.
More than 20 suspected cartel members have been arrested in connection with the killings, including the alleged mastermind of the massacre.
But 16 state policemen have also been arrested on suspicion of protecting the criminals.
Outgoing Tamaulipas security chief Gen Ayala said he was stepping down because the state government had failed to provide increased pay and better equipment for the state police.
His replacement, Capt Lomeli, was previously head of the Federal Police in Nuevo Leon, another northern border state where drug-related violence is rife.
He said he was committed to pacifying Tamaulipas, which is the scene of a bloody battle between the Zetas and the rival Gulf cartel, who are competing for control of drug smuggling routes into the US.
The mass graves containing 145 bodies were found in the municipality of San Fernando, near the US border.
Most of the victims are thought to have been abducted from long-distance buses travelling north to the US border.
The motive for the murders is unclear, but there is speculation the cartel gunmen may have killed men who refused to join their ranks.
The bodies of 72 Central and South American migrants were found in the same area last year.
On Saturday the Mexican navy captured Omar Martin Estrada – alias “El Kilo” – the suspected leader of the Zetas in San Fernando and alleged mastermind of the killings.
Forensic scientists have been working to identify the bodies, some of which have been taken to Mexico City.
Hundreds of people whose relatives have gone missing have gone to see if they can identify their family members among the dead.
The Mexican government says around 35,000 people have been killed in drug-related violence since President Felipe Calderon began deploying troops to fight the cartels in December 2006.
More than 5,000 people have been reported missing, according to Mexico’s human rights commission.