CANCUN, Mexico -- Two Canadians were among at least five people killed Monday in a shooting attack at an electronic music festival in Mexico's Caribbean coast resort of Playa del Carmen, Mexican authorities said.

And Canadian government officials added that at least two other Canadians were wounded in the deadly incident at a popular night club.

The attorney general of Quintana Roo state said three of the dead appear were part of the security detail at the 10-day BPM electronic music festival.

Miguel Angel Pech said the shooting occurred about 2:30 a.m. at the Blue Parrot nightclub, one of the BPM Festival's venues in Playa del Carmen, just south of Cancun.

Pech said a lone gunman apparently tried to enter the nightclub, but was denied access because he had a gun.

The gunman began to exchange fire with another person inside, he said, and festival security personnel tried to stop the shooting and came under fire.

Pech said it was not a terrorist attack and that three people had been detained nearby, but it was unclear if they had been involved in the shooting.

"We know of another shooting incident that occurred near the nightclub, but we are investigating whether that is related" to the nightclub shootings," Pech said.

He said 20 bullet casings from three different pistols had been found at the scene, and said it was unclear if the security detail had been armed or fired any of the weapons.

The government of the township that includes Playa de Carmen referred in a statement to "attackers who fired shots," but did not provide further details.

The shooting apparently caused a rush of people heading for the exits at the beach-side club, and the lone female victim was apparently killed during the stampede.

Pech said 15 people were injured, included one Mexican woman who was seriously injured. He said eight of the injured --including two U.S. citizens and one Canadian --had been treated for less serious injuries at local hospitals and released.

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

Rodolfo Del Angel, director of police in the state of Quintana Roo, told the Milenio TV station that he 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.

The BPM Festival posted a statement saying four people had been killed and 12 injured in an attack that involved "a lone shooter."

BPM wrote that "the violence began on 12th street in front of the club and three members of the BPM security team were among those whose lives were lost while trying to protect patrons inside the venue."

Playa del Carmen has largely been spared the violence that has hit other parts of Mexico.

Global Affairs Canada said it was able to confirm at least one Canadian fatality and was looking to verify the report about the second death.

"Consular officials in Playa Del Carmen and Mexico City are in ongoing contact with local authorities as they continue to address this tragic incident, and are providing consular assistance to Canadian citizens affected by the incident, including two who have been injured," spokeswoman Jocelyn Sweet said in an email.

- with files from The Canadian Press.