Mexican soldiers stand guard outside the bar in Coatzacoalcos, Veracruz. (AFP)

Gunmen burst into a Mexican strip club in a hail of bullets and killed at least 26 people as they trapped revellers inside and started a raging fire, officials said Wednesday.

President Andres Manuel Lopez Obrador condemned the "shameful" attack in the city of Coatzacoalcos, and said federal authorities would investigate evidence it may have stemmed from collusion between local authorities and organized crime.

The Tuesday night attack, which officials said also left 11 people badly wounded, is the latest to rock the state of Veracruz, a flashpoint in bloody turf wars between Mexico's rival drug cartels and a hotbed of political corruption.

Survivors said gunmen sprayed bullets as they descended on the bar, the Caballo Blanco (White Horse), then blocked the exits and set the club alight.

Because of the loud reggaeton music pounding inside, many patrons and dancers did not even notice the attack until the bar was in flames, they said.

Authorities said many of the victims died of smoke inhalation. It was not immediately clear whether some died of gunshot wounds.

"They arrived in several vehicles, with rifles and pistols. They threatened the security guards at the door and took control of the entrance," one survivor told an AFP reporter, speaking on condition of anonymity, as frantic relatives gathered at the bar looking for their loved ones.

Veracruz Governor Cuitlahuac Garcia tweeted that authorities had identified one of the attackers as Ricardo "N" -- Mexican law bars the release of suspects' full names -- adding that he was a repeat offender known as "La Loca" ("The Crazy One").

The suspect was previously arrested last month, but was released by state prosecutors within 48 hours, Garcia said.

President Lopez Obrador said federal authorities would investigate why.

"There's a problem there that needs to be investigated regarding the actions of the Veracruz prosecutor's office," said Lopez Obrador, a leftist elected last year on an anti-corruption platform.

"There are two things going on here: one is this shameful act by organized crime, the most inhuman thing possible; the other, which is also reprehensible, is a possible conspiracy with the authorities," he told a news conference.

The Veracruz prosecutor's office denied wrongdoing, and said in a statement that it was in fact the federal prosecutor's office that released Ricardo "N."

Attackers blocked emergency exits

Veracruz is one of the most violent states in the country.

Its location on the Gulf of Mexico coast makes it a strategic route for drug cartels and for human traffickers bringing undocumented migrants to the United States.

Coatzacoalcos, a port city of 235,000 people, has been among those hardest hit by the resulting violence.

The governor told reporters the group that attacked the White Horse was vying for control of the drug trade there.

Some survivors said the attackers doused the nightclub in gasoline to set it alight. Others said they threw Molotov cocktails.

The interior of the bar was wrecked and charred, with chairs overturned and debris littering the floor.

The naked body of a woman who had been mid-routine was sprawled on the dance floor next to the striptease poles.

Outside, anguished relatives cried and embraced as they waited for news, while soldiers, police and paramedics worked the scene.

"I just want to know if he's OK," said a mother looking for her son, an employee at the bar, after searching for him in vain at local hospitals.

"Have you seen my daughter? She was a dancer," said another.

Hit squads, corruption

Mexico, the chief supplier of narcotics to the United States, has been hit by a wave of violence since declaring war on drugs and deploying the army to fight its powerful cartels in 2006.

Since then, more than 250,000 people have been murdered, including a record 33,753 last year.

The situation in Veracruz has been particularly grim. Jailed ex-governor Javier Duarte (2010-2016) is accused of presiding over a rash of corruption and human rights abuses.

Two former state police chiefs and a string of ex-officials have been charged with running hit squads that abducted and presumably killed unwanted individuals during Duarte's administration.