Magic mushrooms are illegal in most countries but the hallucinogen has been used by humans for thousands of years. A new controlled study by Imperial College London has found the active ingredient in them — psilocybin — may help cure depression.

In a paper titled “Psilocybin for treatment-resistant depression: fMRI-measured brain mechanisms,” published Friday in the journal Scientific Reports, the researchers wrote: “Treatment with psilocybin produced rapid and sustained antidepressant effects,” while pointing out that they were “limited by the small sample size as well as the absence of a control group — such as a placebo group — to directly contrast with the patients.”

For the clinical trial — the first of its kind — the Imperial researchers gave psilocybin to 19 patients suffering from depression in two doses. The first dose of 10 mg (1 milligram is a thousandth of a gram, and a thousand grams equal 2.2 pounds) was followed a week later by the second dose of 25 mg. The patients’ brains were imaged using fMRI (functional magnetic resonance imaging) before and after the doses, and they also reported their depressive symptoms using clinical questionnaires.

Both the patients’ responses and their brain activity showed improvement immediately following the psilocybin treatment. The improvement in their condition also lasted for as long as five weeks.

The patients “reported a decrease in depressive symptoms — corresponding with anecdotal reports of an ‘after-glow’ effect characterized by improvements in mood and stress relief,” according to a statement by the college.

The fMRI scanning “revealed reduced blood flow in areas of the brain, including the amygdala, a small, almond-shaped region of the brain known to be involved in processing emotional responses, stress, and fear. They also found increased stability in another brain network, previously linked to psilocybin’s immediate effects as well as to depression itself.”

Dr. Robin Carhart-Harris, who heads psychedelic research at Imperial and was the leader of the study, said in the statement: “Several of our patients described feeling ‘reset’ after the treatment and often used computer analogies. For example, one said he felt like his brain had been ‘defragged’ like a computer hard drive, and another said he felt ‘rebooted’. Psilocybin may be giving these individuals the temporary ‘kick start’ they need to break out of their depressive states and these imaging results do tentatively support a ‘reset’ analogy. Similar brain effects to these have been seen with electroconvulsive therapy.”

While the researchers found their initial findings to be “encouraging,” they warned that the research was still at a very early stage and that people suffering from depression should not attempt to self-medicate. There was a large psychological component to the therapy that the researchers tested, which would be missing in cases of self-medication. Also, as they noted in the study, a sample size of 19 people is not nearly enough to validate an effective treatment method, especially since there was no control group with which to compare the effects of psilocybin.

“Larger studies are needed to see if this positive effect can be reproduced in more patients. But these initial findings are exciting and provide another treatment avenue to explore,” David Nutt, a senior author of the paper, said in the statement.