The US Food and Drug Administration (FDA) has given the green light to phase three trials of MDMA to treat post-traumatic stress disorder, the final phase of validation required to turn the party drug into a legal medicine.

The treatment involves giving patients the drug just three times – once a month – during long talking therapy sessions, interspersed with weekly sessions without the drug. Early trials of the drug, currently listed as a schedule 1 substance by the Drug Enforcement Administration along with heroin and LSD, have shown encouraging results for patients with treatment-resistant PTSD.

“Moving from phase two to phase three shows we have strong scientific reason to believe that MDMA is an effective treatment for PTSD in therapy. The fact the FDA is ready to move forward with phase three signals that they agree,” said Brad Burge, from the Multidisciplinary Association for Psychedelic Studies (Maps), a not-for-profit based in Santa Cruz, California, that has spearheaded efforts to turn MDMA into a medicine.

If the trials go well, MDMA could be legalized as soon as 2021, providing a novel way to treat those battling with PTSD, a debilitating mental condition that can be caused by witnessing or experiencing a life-threatening event.

PTSD is common among military veterans, victims of sexual abuse and refugees with symptoms including anxiety attacks, body shakes, nightmares and insomnia. While many patients respond to established treatments such as cognitive behavioral therapy or eye movement desensitisation and reprocessing (EMDR), a subsection battle with the disorder for decades.

“Currently approved treatments do work for some people, but they aren’t working for at least a third of patients,” Burge said.

James “CJ” Hardin suffered with the disorder for years following his three tours in Iraq and Afghanistan. He had nightmares and insomnia and loud sounds or flashes of light could send him into a state of anxiety. He was given psychotherapy and prescribed antidepressants and anti-anxiety tablets, but nothing worked.

That is, until he he enrolled in one of Maps’ trials of MDMA-assisted psychotherapy. Hardin experienced a dramatic turnaround in his mental health within three months, and no longer has PTSD.

“It has allowed me to be a productive member of society and given me new hope,” he said.

One South Carolina study involved 20 patients, mostly victims of sexual abuse, who had suffered from PTSD for more than 19 years. It was a placebo-controlled study, so all patients were given the same therapy, but only some were given the MDMA; 83% of those given the MDMA no longer met the criteria for PTSD following treatment, compared with 25% of those who were not given the drug. The results have held for several years.

Maps has funded a total of six phase two studies of the drug, in which 136 patients have undergone MDMA-assisted therapy. Phase three trials require bigger groups of patients, at least 230 people, across different countries.

Maps submitted data from its phase two trials along with plans for phase three to the FDA a month ago. On 29 November, the FDA gave the final phase of trials the go-ahead, subject to further clarification on a few technical details, including how to ensure double blinding with a drug whose effects are so dramatic. The recruitment of patients is scheduled to start in June 2017.

Hardin is “elated” that the phase three trials have been approved. “I love it. This is where we needed to be. I am one of the lucky few that got this amazing treatment. I don’t want to be the guy that got lucky – I want everybody to have this opportunity to recover.”

Once phase three trials are completed, and provided the results still look positive, the data can be submitted to the FDA for approval. In theory this means MDMA would be legalized for therapeutic use by 2021. (Although around 50% of drugs fail at phase three.)

The drug would not be available on prescription for patients’ use at home in the same way that marijuana is in many US states. The design of the trials means that the drug could only be administered by a trained psychotherapist in licensed centers.

“People come into a clinic and receive one MDMA pill from the doctor and take it right away for their therapy session. They don’t take it home,” said Burge.

He is swift to distinguish between the trial MDMA and the club drug ecstasy or molly.

“Less than half of the ecstasy or molly available on the street contains any MDMA at all, and it usually contains far more harmful adulterants,” he said. That’s not to say that MDMA is risk-free. The drug, particularly when taken in a clubbing environment, can lead to overheating and organ failure.

The MDMA pills given to patients during the trials are pharmaceutical grade with a known dose, created at a high security facility near the small village of Dudley in the north of England, at a cost of $400,000 per kilo. Maps is fundraising to buy enough of it to complete phase three trials. “It’s a way for people to legally buy MDMA,” he joked.