MEXICO CITY — Two mayoral candidates in two different Mexican towns have been killed in less than 24 hours, marking a total of at least 18 candidates killed so far in campaigns leading up to the July 1 elections.

An independent mayoral candidate was gunned down in the conflict-ridden rural town of Aguililla in the western state of Michoacan on Wednesday. Michoacan Gov. Silvano Aureoles vowed to catch those responsible for killing candidate Omar Gomez Lucatero.

Aguililla is an extensive but sparsely populated mountain township where drug gangs and vigilantes have been active.

And early Thursday, the mayoral candidate for the leftist Democratic Revolution Party was killed in Ocampo, also in Michoacan.

Mexican soldiers guard the funeral of Ocampo municipality Mayor and candidate for the Democratic Revolutionary Party (PRD), Fernando Angeles, in Ocampo, Michoacan State, Mexico, on June 21, 2018. Raul Tinoco / AFP - Getty Images

His party said issued a statement saying that Fernando Angeles Juarez was assassinated, and called on the government to provide protection for people running in the July 1 elections.

Ocampo is a rural township about 95 miles (150 kilometers) west of Mexico City best known for the Monarch butterfly wintering grounds that occupy part of the mountainous municipality. It also been plagued by illegal logging and gangs.

Almost all of the 18 candidates killed across the country so far have been running for local posts in the July 1 elections, which will also decide the presidency, governorships and Congress. Other politicians who were considering a run have been killed before they could even register as candidates. The killings have particularly hit states like Michoacan, Guerrero and Oaxaca.

Mexican security analyst Alejandro Hope said that in part, the level of violence against candidates can be explained by “simple mathematics:” There are far more elections being held simultaneously than ever before in Mexico. With more than 3,400 local, state and federal posts at stake, there are more than 15,000 candidates hitting the campaign trail.

“Secondly, this speaks to the changes in criminal groups,” Hope said, noting that drug cartels have expanded into extortion, fuel theft and other crimes. “With the evolution of crime, it becomes much more important to gain control over territory, over local governments.”

In crimes like fuel theft, for example, local police can be valuable allies to act as look outs or cover up for illegal pipeline taps and illicit fuel warehouses. And some gangs have even taken to extorting money from local governments by forcing them to sign inflated public works contracts.

Those concerns could lead the gangs to kill a candidate who rivals their favorite, or to kill candidates who refuse their demands.

Finally, Hope noted, “there has been a breakdown in the management of disputes,” largely in rural areas, where turf wars between rival gangs have heated up, even as the government has become over-extended and less able to intervene.

FOLLOW NBC LATINO ON FACEBOOK, TWITTER AND INSTAGRAM.