A wild shootout involving AK-47 assault rifles and pistols has left at least 13 inmates dead at a Panama prison.

The chaos that erupted Tuesday at the La Joyita jail east of Panama City took place inside a block that houses inmates who belong to the same local gang, officials said.

"These firearms didn't fall out of the sky, there was obviously some type of cooperation there for firearms to be brought in," President Laurentino Cortizo said following the shooting, according to the BBC.

Cortizo vowed to launch an investigation into how the weapons were smuggled inside the jail and is reported to be meeting with his security council Wednesday to discuss the matter. Five pistols and three AK-47 assault rifles were found after the shooting.

BRAZIL PRISON RIOT LEAVES 57 DEAD -- INCLUDING 16 DECAPITATED

"It's something we have to put a stop to. A few weeks ago a search was carried out [in the prison] and arms were found, and now again, so someone is letting these guns in," Cortizo was quoted by the BBC as saying.

Alexis Muñoz, assistant director of the National Police, also said such smuggling has been a longstanding problem and “there are many ways that weapons can get in.”

In addition to the 13 inmates killed, 15 others were injured during the gunfire.

CLICK HERE TO GET THE FOX NEWS APP

Muñoz, the BBC said, announced that the shootout unfolded after gang members had "an internal disagreement."

The Interior Department said no guards or prison personnel were hurt in the confrontation and no escapes were reported.

The Associated Press contributed to this report.