Mexico City: Gunmen in southern Mexico stormed a town hall and killed the mayor in a broad daylight attack that left at least 17 others dead on Wednesday, authorities said.

In a statement, the Guerrero state prosecutor's office pledged to arrest those responsible for killing both the mayor of San Miguel Totolapan and his father, also a former mayor.

Local TV footage showed the facade of the municipal building riddled with bullets while people were heard screaming.

"Until now, we have 18 confirmed deaths and two injured," State Attorney General Sandra Luz Valdovinos told Milenio Television.

Along with Mayor Conrado Mendoza, police officers and city council workers were also killed, the prosecutor's office told local media.

The motive of the attack was not immediately known.

On Twitter, Mendoza's leftist Party of the Democratic Revolution (PRD) condemned the "cowardly murder".

"We demand justice, enough of impunity," the PRD wrote.

Following the attack, a defense body that includes both state and federal officers said it had deployed personnel to the area.

Guerrero Governor and member of the ruling Morena party Evelyn Salgado said she had requested an expedited investigation into the mass shooting.

"There will be no impunity for the vicious aggression," she tweeted.

"I join the grief that overwhelms family and friends."

- Los Tequileros -

Local media said the attack was staged by Los Tequileros (The Tequila Drinkers), a gang affiliated with the Jalisco Nueva Generacion drug cartel.

Los Tequileros were previously active in San Miguel Totolapan for several years, mainly staging kidnappings in exchange for ransom money.

But the group's influence dwindled after the death of one of its leaders in 2018 in a gunfight with police.

Just days before Wednesday's attack, alleged members of Los Tequileros had circulated a video on social media threatening to return to the town, local press reported.

Guerrero, one of the poorest states in Mexico, has endured years of violence linked to turf wars between several drug cartels fighting for control of the state's opium poppy and heroin production areas.

Located in the violence-wracked Tierra Caliente region, San Miguel Totolapan sits along a drug trafficking route disputed by different cartels.

Mexico has endured more than 340,000 killings blamed mainly on drug trafficking gangs since the government deployed troops to fight the cartels in 2006.

According to data from consulting firm Etellekt, 94 mayors -- including Mendoza -- have been murdered in Mexico since 2000.