Officials report that at least 17 other people, including the mayor of a tiny town in western Mexico, have been killed by gunmen.
According to police, armed individuals attacked the San Miguel Totolapan town hall on Wednesday around 14:00 (19:00 GMT). Photos posted online to demonstrate how bullet-riddled it is.
Mayor Conrado Mendoza Almeda’s left-wing PRD party condemned his “cowardly” assassination and demanded justice.
The attack has been blamed on the Los Tequileros criminal gang, which is linked to a powerful drug cartel.
Police officers and council workers were also killed in the massacre, with graphic images of bloodied bodies lying on the ground circulating on social media.
Mr Mendoza Almeda’s father, the former mayor Juan Mendoza Acosta, was also killed – in his home – before the attack moved to the town hall.
A highway in the state of Guerrero, where San Miguel Totolapan lies, was reportedly briefly blocked by large vehicles to prevent security forces from getting into the city.
Even by the violent standards of Guerrero state, this was a shocking attack, reports the BBC’s Mexico correspondent, Will Grant.
San Miguel Totolapan lies in the heart of a region known as Tierra Caliente, a violent part of drug cartel-controlled western Mexico.
Various groups battle for control of the lucrative drug routes north along the Pacific corridor, our correspondent adds.
In a preliminary report seen by local media, Guerrero’s attorney general said that as well as the 18 people who were killed, three others were wounded.
Following the attack, the defence ministry said it was deploying army and navy units to the area to find the gunmen.
Guerrero Governor Evelyn Salgado Pineda tweeted to say she deeply regretted the deaths.
Shortly before the attack, alleged members of Los Tequileros released a video on social networks announcing its return to the region, where they had been fighting a rival drug gang.
The criminal group devastated Guerrero between 2015 and 2017 – and was known for threatening mayors of the region – until its leader, Raybel Jacobo de Almonte was assassinated.
De Almonte was known as El Tequilero – the Tequila Drinker – and his gang took their name from him.