Clubgoers who take the party drug MDMA — better known as ecstasy or Molly - may be unknowingly consuming "bath salts" and other potentially dangerous contaminants, according to a new study.

MDMA is among the most popular drugs in the electronic dance music festival and nightclub scenes. Though its use has been in decline, the rates of poisoning have increased in recent years, said Joseph J. Palamar, an epidemiologist at New York University and co-author of the study.

"The natural conclusion was that the ecstasy was being contaminated," Palamar said. "Ecstasy wasn't always a dangerous drug, but now people are taking garbage without realizing it."

The study was published last week in the journal Drug and Alcohol Dependence.

The fact that some dealers cut their drugs with other substances is well-known, said Chris Burrell, electronic music director at Drexel's WKDU-FM.

"But hearing about bath salts in MDMA is alarming," said Burrell. "If you look at the major DJ websites, they're always circulating stories warning about specific batches of MDMA/Molly/ecstasy that are known to be dangerous and tainted."

Bath salts, a class of designer drugs called banned in the U.S. in 2012, have a neurological effect similar to MDMA but are associated with "adverse health outcomes" that include paranoia, agitation, chest pains, suicidal thoughts and death.

Palamar and his team analysed hair samples taken from dozens of EDM festival goers and New York nightclub ravers who said they had taken MDMA but had not knowingly consumed bath salts.

Almost half of the samples tested positive for butylone, a common component of bath salts. Others tested positive for another psychostimulant, methylone, and flakka, which Palamar described as stronger than methamphetamine and "kind of a like a crack replacement."

Getting those hair samples - often at 2 a.m. and in limited light - was awkward, Palamar said in an interview. Many of the men at the clubs and festivals didn't have enough hair on their heads.

"Fortunately, I had an idea to bring a tiny electric buzzer, thinking maybe they'll let us buzz hair off their legs or chest," he said.

"I'm doing it in the dark. I can't see anything," Palamar said. "Meanwhile people are laughing and Tweeting 'I just donated my pubes to science!'."

Without a lab test, Palamar said it's very difficult to tell the difference between real MDMA and the fakes. Ecstacy once was consumed primarily in pill form. But because the drug is now sold as a powder, it can be cut with anything by anyone.

"When you see people on real ecstasy, they're empathetic and hugging everyone," he said. "Now, they just like they're tweaking, like they've taken a big dose of stimulants."

Palamar said he hopes his research helps people in the electronic dance music scene. The 38-year-old assistant professor is not a typical federally-funded researcher, he said. Fifteen years ago, he was a denizen of the same nightclubs he studies now. He recommends that the DEA test more seized ecstasy to better monitor the drug market. And for users who aren't scared off by the possibility of bath salts in their ecstacy, he suggests they get a drug test kit.

"Kids are going to do what they're going to do. You're not going to stop them," he said. "But if they feel that they have to use drugs, the kids have to do it safely and they need as much information as possible."