Few drugs are as two-faced as ketamine. By day, it works as a legitimate anesthetic, sitting comfortably on the World Health Organization’s list of Essential Medicines. By night, though, it moonlights as a party drug, sending users into an intense dissociative state (read: not in touch with reality) known as a K-hole.

Of late, ketamine has also been finding work as a novel antidepressant, administered intravenously in not-illegal-but-also-not-mainstream clinics. Thing is, no one knows exactly how the drug works to alleviate depression—same as other antidepressants, really. But today in The American Journal of Psychiatry, Stanford University researchers report that ketamine may be working on the brain’s opioid system. The study is small, but if replicated, the findings could have big implications for the treatment of depression.

In the study, researchers took a group of people suffering from treatment-resistant depression and gave them two intravenous doses of ketamine, separated by at least two weeks (ketamine’s antidepressant effects wear off after about a week). An hour before one dose, the patients took a placebo. But an hour before the other dose, the patients instead received the drug naltrexone, which blocks the effects of opioids.

If ketamine really is working through the opioid system, theoretically the naltrexone should block its effects. And indeed, the patients who received naltrexone didn’t see improvement in their symptoms. But with a placebo, the patients’ depressive symptoms vastly improved. Seven of the 12 participants—who, again, were suffering from treatment-resistant depression—saw their symptoms wane when they took the placebo before the dose of ketamine.

Most research on how ketamine works has focused on the neurotransmitter glutamate, not its interaction with the opioid system. “One of ketamine’s many effects is that it blocks a certain type of glutamate receptor,” says Stanford anesthesiologist Boris Heifets, co-lead author on the paper. “And so people put two and two together and said, ‘Well clearly if you block glutamate receptors, then you can alleviate depression.’”

Ketamine, though, acts suspiciously like an opioid in that it’s a powerful pain reliever. Scientists have been well aware of this. Still, though, the glutamate theory has held. “This idea that ketamine has some kind of opioid effect was mostly ignored in the research,” Heifets says. Which is not to say glutamate isn’t still in play—it could help sustain the initial, rapid effects of ketamine.

“I think it's a very interesting paper,” says Yale psychiatrist Gerard Sanacora, who studies ketamine. “It does highlight that there are probably many factors that influence how ketamine is producing its antidepressant-like effect.”

The study may also help explain the link between depression and pain, both of which ketamine is good at treating. Depressed patients who go in for hip or knee surgery, for example, use an average of 2.4 times as many opiates by day three after the operation, compared with those not suffering from depression. The assumption might be that they’re in more physical pain and therefore need more pain meds. “Or is it that they're also kind of treating their depression simultaneously while they're taking increased doses of opiates?” asks Nolan Williams, the Stanford psychiatrist who is co-lead author on the new paper.

So if ketamine can indeed treat depression and pain by interacting with the opioid system, would that make it a full-on opioid? “This is an interesting question,” says Alan Schatzberg, a coauthor and also a Stanford psychiatrist. “Clearly you have two possibilities for the mechanism for affecting the opioid system.” One is that ketamine is interacting directly with opioid receptors, the other is that it’s leading to the release of endorphins. “We can't fully answer that question,” Schatzberg adds. At least not yet.