The use of illegal drugs for medicinal reasons is a controversial topic, even as more states and jurisdictions allow the use of medical marijuana and other substances every year.

And self-medicating — using drugs without the assistance of a doctor or other medical professional — can be dangerous. "Potential risks of self-medication practices include incorrect self-diagnosis, delays in seeking medical advice … incorrect dosage, incorrect choice of therapy, masking of a severe disease, and risk of dependence and abuse," wrote the authors of a 2010 article published in the journal Current Drug Safety.

Because of these risks, doctors strongly advise against the unregulated use of illicit drugs, which can do more harm than good. Nonetheless, medical researchers continue to find a surprising number of health benefits in drugs widely used for recreational purposes. [Image Gallery: 7 Potent Medicinal Plants]

Magic Mushrooms: Mushrooms containing psilocybin produce colorful hallucinations, even when consumed in small quantities. There's also some evidence that small amounts of psilocybin can relieve the symptoms of cluster headaches, obsessive-compulsive disorder and depression.

Research published in the British Journal of Psychiatry in 2012 found that volunteers taking psilocybin had enhanced recall, making the substance an effective adjunct to psychotherapy. Another 2012 study, published in the Proceedings of the National Academy of Sciences, found that the drug slowed activity in the centers of the brain that are hyperactive in people with depression.

"We're not saying go out there and eat magic mushrooms," Robin Carhart Harris, lead author of both studies, told Reuters. "But ... this drug has such a fundamental impact on the brain that it's got to be meaningful. It's got to be telling us something about how the brain works. So we should be studying it and optimizing it if there's a therapeutic benefit."

Ecstasy: Also known as MDMA, ecstasy is a synthetic compound that produces hallucinations, feelings of emotional warmth and high levels of energy. The same psychoactive properties that make ecstasy so popular with partygoers may also make it useful in treating post-traumatic stress disorder, or PTSD.

Other research has found that ecstasy has robust anticancer properties, particularly for leukemia, lymphoma and myeloma. In 2011, researchers from the University of Birmingham found that a slightly modified form of ecstasy was 100 times more potent at destroying cancer cells than the original form of MDMA. "Further work is required, but this research is a significant step forward in developing a potential new cancer drug," the researchers said in a statement.

Cocaine: Leaves of the coca plant (Erythroxylum coca) have been used as a stimulant in South America for thousands of years. The drug derived from coca, cocaine — popularly known as coke, blow or Bolivian marching powder — has been credited with a range of health benefits.

Cocaine can be used as a topical anesthetic for surgical procedures due to its rapid-acting numbing properties. When combined with other compounds into a preparation called TAC, cocaine can also treat minor skin lacerations, since the drug is an effective vasoconstrictor (narrows blood vessels).

Dr. Andrew Weil, founder and director of the Arizona Center for Integrative Medicine, has studied coca's gastrointestinal effects among South American communities. "If you look carefully at the coca leaf's molecular array, you find 14 bioactive alkaloids … while cocaine acts as a gut stimulant, other coca alkaloids can have precisely the opposite action. They inhibit gut activity," Weil wrote in the Huffington Post.

"During my time in Andean Indian communities, I collected many reports about whole coca's paradoxical, normalizing effect on bowel function, and experienced it firsthand, as well," he wrote.

LSD: Lysergic acid diethylamide, usually known as LSD or acid, is a hallucinogen that's been widely used for decades, but recent research finds it has some potential for treating alcoholism. A study from Norway, published in 2012 in the Journal of Psychopharmacology, suggests that LSD prevented alcoholics from relapsing during treatment.

"LSD worked in an entirely different way than any current psychiatric drugs," said study author Teri Krebs of the Norwegian University of Science and Technology. "Many patients said they had gained a new appreciation for their alcohol problem and new motivation to address it." [Slideshow: Scientists Analyze Drawings by an Acid-Tripping Artist]

Ketamine: Also called "Special K," this animal tranquilizer is sometimes used as a recreational drug by attendees at dance raves and other events. The drug may also effectively combat the symptoms of depression.

A 2012 study from the journal Science found that ketamine may help stimulate the growth of synapses in the brain, and beneficial effects of the drug on people with chronic depression can occur within hours. "The rapid therapeutic response of ketamine in treatment-resistant patients is the biggest breakthrough in depression research in a half century," Ronald Duman, professor of psychiatry and neurobiology at Yale University, said in a statement.

Marijuana: Pot, in addition to being the most widely used illicit drug in the United States, has a raft of medical benefits. According to NORML (a marijuana advocacy group), 21 states and the District of Columbia allow some use of medical marijuana.

The drug has been shown through years of scientific research to relieve chronic pain, prevent PTSD, stimulate appetite for people with AIDS wasting syndrome, control nausea, relieve intra-ocular pressure associated with glaucoma, treat opioid dependence and improve the symptoms of Crohn's disease.

Follow Marc Lallanilla on Twitter and Google+. Follow us @livescience, Facebook & Google+. Original article on LiveScience.