There is no evidence that ecstasy causes brain damage, according to one of the largest studies into the effects of the drug. Too many previous studies made over-arching conclusions from insufficient data, say the scientists responsible for the research, and the drug's dangers have been greatly exaggerated.

The finding will shock campaigners who have claimed ecstasy poses a real risk of triggering brain damage. They have argued that it can induce memory loss, decrease cognitive performance and has long-lasting effects on behaviour.

But experts who have argued that the drug is relatively safe welcomed the new paper. "I always assumed that, when properly designed studies were carried out, we would find ecstasy does not cause brain damage," said Professor David Nutt, who was fired as chair of the Advisory Council on the Misuse of Drugs by Alan Johnson, then home secretary, for publicly stating alcohol and tobacco were more harmful than ecstasy.

The study was carried out by a team led by Professor John Halpern of Harvard Medical School and published in the journal Addiction last week. Funded by a $1.8m grant from the US National Institute on Drug Abuse, it was launched specifically to avoid methodological drawbacks that have bedevilled previous attempts to pinpoint whether or not ecstasy users suffer brain damage.

Ecstasy – or 3,4-Methylenedioxymethamphetamine, or MDMA – came into widespread use in the 1980s when taking it was linked to raves and the playing of dance music. Its symptoms include euphoria, a sense of intimacy with others and diminished anxiety and depression. In the US alone, more than 12 million have taken it.

But the taking of ecstasy has also been linked to damage to the central nervous system and research in recent years has suggested that long-term changes to emotional states and behaviour have been triggered by consumption of the drug. Possession of it has been made an offence in most western nations.

However, Halpern was sharply critical of the quality of the research that had linked ecstasy to brain damage. "Too many studies have been carried out on small populations, while overarching conclusions have been drawn from them," he said. For a start, some previous research has studied users who were taken from a culture dominated by all-night dancing, which thus exposed these individuals to sleep and fluid deprivation – factors that are themselves known to produce long-lasting cognitive effects. Non-users were not selected from those from a similar background, which therefore skewed results. In addition, past studies have not taken sufficient account of the fact that ecstasy users take other drugs or alcohol that could affect cognition or that they may have suffered intellectual impairment before they started taking ecstasy. In Halpern's study only ecstasy users who took no other drugs and who had suffered no previous impairment were selected.

The resulting experiment whittled down 1,500 potential participants to 52 selected users, whose cognitive abilities matched those of a group of 59 non-users. "We even took hair samples of participants to test whether they were telling the truth about their drug and alcohol habits," said Halpern. "Essentially we compared one group of people who danced and raved and took ecstasy with a similar group of individuals who danced and raved but who did not take ecstasy. When we did that, we found that there was no difference in their cognitive abilities." In other words, previous studies highlighted problems triggered by other factors, such as use of other drugs or drink, or sleep deprivation.

But the drug still posed risks, he said. "Ecstasy consumption is dangerous because illegally made pills often contain contaminants that can have harmful side-effects."