On Thursday, researchers at the Chalmers University of Technology in Sweden announced an impressive, futuristic new finding: They were able to reduce phantom limb pain in chronic cases by over 50 percent with augmented reality and machine learning.

Dr. Max Ortiz Catalan pioneered the work published Thursday in The Lancet, and tells Inverse that the “non-invasive, low-risk” therapy “holds great potential to treat the condition.”

Catalan used machine learning, a form of artificial intelligence, to build a brain-computer interface that collects and interprets neurological signals sent to the phantom limb and translates them into movement commands.

“The approach we propose to treat phantom limb pain showed promising results in patients for whom all previous treatment failed,” Catalan says.

When someone wishes to move an extremity, the brain sends signals to the necessary muscles. If the extremity has been amputated, those signals still go through. Researchers can place surface electrodes on the stump of the amputated limb, then record the muscle activation. After connecting the patient’s intended movements with these muscle activation signals, the A.I. can learn particular signals that correspond with particular intended movements. In other words, the computer picks up on the activation pattern, then translates that into a gesture, like opening or closing one’s hand.

Dr. Max Ortiz Catalan. Anna-Lena Lundqvist

That’s impressive enough. But Catalan had the additional insight to pair these signals and movements with augmented reality. He designed a system that converted the A.I.’s output into a live, AR-visual feed of the virtual limb, as this video demonstrates:

However, he says there are no plans for the high-tech augmented reality headsets to be used during therapy. “We have used them but I don’t think they add much to the relief of pain, although it’s a ‘cool’ technology,” Catalan tells Inverse.

Here’s how the therapy works: A patient thinks and acts out a gesture. The surface electrodes and the A.I. then decode those signals, and send the corresponding gesture to the AR interface. The AR, a live-streamed mirror of the patient — with its virtual limb in place of the phantom limb — then reproduces this gesture in the virtual limb. The system was so sophisticated that, in effect, patients could play video games with their mind.

An amputee patient tries out the AR system. Ortiz-Catalan et al., The Lancet, 2016.

It’s similar to more traditional methods, like mirror box therapy, which also attempts to trick the mind. The underlying idea is that by fooling the brain into seeing its attempts to move a nonexistent limb come to fruition, the pain gradually dissipates.

Such treatments seek to revitalize areas in the brain that once pertained to the phantom limb’s movements. The hope is that as these areas warm up again, the scientifically inexplicable pain fades. But for some, even mirror therapy fails to alleviate the discomfort. Others try to medicate the pain away, but still find no relief.

Catalan picked 14 of these most troubled patients — all arm amputees, in this case — for his study. Each went through 12 AR sessions. At the end of the sessions, the intensity and frequency of the pain had reduced by about 50 percent. Half of the painkiller-dependent patients were able to curtail their dependence.

“The pain continuously decreased all the way through to the last treatment,” Catalan said in a press release. “The fact that the pain reduction did not plateau suggests that further improvement could be achieved with more sessions.”

He hopes to further prove the results of this study, and to incorporate leg amputees into the treatment system, too. In addition, Catalan released the relevant code to the public, for free; he also plans to commercialize a clinic-friendly version, since A.I. can get a bit complicated.