A gunman has killed at least five people and wounded nine others at a nightclub in the Playa del Carmen resort, Mexico, the Associated Press has reported.

Nightclub Blue Parrot was hosting the final night of the BPM electronic music festival, a popular event among foreign tourists. A second shooting was also initially reported at another nightclub, The Jungle, but the reports were not confirmed by an official source as of press time.

Authorities said a lone gunman apparently entered the nightclub and began to exchange fire with another person inside around 02.30am local time (07.30am GMT) on 16 January. Festival security personnel tried to stop the shooting and came under fire. Five people were killed, including two Canadians, an Italian and a Colombian, and 15 were injured, authorities said in a press conference.

Authorities said it was not a terrorist attack. Rodolfo Del Angel, director of police in the state of Quintana Roo, told the Milenio TV station that the shooting was the result of "a disagreement between people inside" the nightclub and said security guards had come under fire when they tried to contain the dispute. As many as 20 bullet casings fired from three different pistols were found at the scene, but it remained unclear whether any of these were fired by the security personnel.

In a statement published on Facebook, the BPM festival confirmed three members of the BPM security team lost their lives while trying to protect patrons inside the venue.

"We are overcome with grief over this senseless act of violence and we are cooperating fully with local law enforcement and government officials as they continue their investigation," the statement read.

OFFICIAL STATEMENT (UPDATED*):It is with great sadness to share that police have confirmed reports of a lone shooter...

Posted by The BPM Festival on Monday, January 16, 2017

The attorney general of Quintana Roo state Miguel Angel Pech said 15 people were injured, included one Mexican woman who reported serious injuries. Five of the injured, including two US citizens and one Canadian, received treatment at local hospitals and were discharged. One women was apparently killed during the stampede caused by a rush of people fleeing the club.

Pech said three people had been detained in the area, but it was unclear if they had been involved in the shooting.

Blue Parrot nightclub
Police officers patrol near a nightclub in Playa del Carmen, where the shooting occurred AFP/Getty Images

Australian DJ Danny Chien, better known as Wax Motif, wrote about the attack on Twitter. It "happened right in front of us", he said. He described seeing a person getting shot, and "at least four bodies down on the escape" before he ran down to the beach with his friends.

British DJ Sidney Charles wrote on Twitter he was on the decks when the attack began, but he and his friends were safe.

A video filmed by Mexican DJ MauroMC showed the commotion outside the club in the aftermath of the attack.

An image shared on social media showed people laying on the ground covered in blood. In the tweet accompanying the photo, the uploader speculated the attack was related to a drug war. However, the Yucatan region of Mexico, where Playa del Carmen is located 70km (43 miles) south of Cancun, has traditionally been spared by the gang violence affecting other areas of the country.

Parrot nightclub shooting