At least four people have been killed after gunmen opened fire at government offices in the Mexican beach resort of Cancun.

It comes just a day after at least five people died in another shooting at a nearby music festival.

Rodolfo del Angel Campos, chief of police for the state of Quintana Roo, said gunfire broke out at the state attorney general's office in Cancun, a city that is one of the most popular seaside destinations for foreign tourists in Mexico.

Federal police and the armed forces were called to the scene, del Angel said.

One policeman and three suspected gunmen were killed, and a further five suspects arrested, state governor Carlos Joaquin told Mexican television on Tuesday evening.

"The state is under control and in order," Joaquin said, adding that he had arranged with the Interior Ministry to send federal forces to reinforce security.

Joaquin, who took office in September, described the attacks as a reaction by gangsters to his crackdown on organised crime, which he said had enjoyed impunity for years.

The ruling Institutional Revolutionary Party (PRI) has been reviewing disciplinary action against Joaquin's predecessor, former PRI state governor Roberto Borge, whom the opposition has accused of fraud and corruption. He denies any wrongdoing.

The state of Quintana Roo has suffered sporadic violence in the past few years as drug cartels battle for control of the lucrative local market.

Changes in power have been known to inflame turf wars between gangs as they fight for supremacy.

On Monday, at least five people were killed and 15 wounded when a gunman opened fire in a nightclub at the nightclub in the resort of Playa del Carmen.

The shooting is not being investigated as a suspected terror attack.