Physician and psychoanalyst John C. Lilly. (John Bryson/Life Images Collection/Getty Images)

John C. Lilly took his first dose of ketamine to help with his chronic migraine headaches.

It worked, and soon Lilly, a renowned counterculture physician and close associate of 1960s psychedelic guru Timothy Leary, was riding increasing doses of the drug into some of the strangest research of the late 20th century.

Ketamine, first developed as an anesthetic, figured largely into two of Lilly’s most famous projects: the invention of the isolation tank and his NASA-funded efforts to communicate with dolphins.

And sometimes it got weird.

“That evening I took 150 milligrams of ketamine,” Lilly said in one interview, describing one of his frequent perceived interactions with other-dimensional beings, “and suddenly the Earth Coincidence Control Office removed my penis and handed it to me.”

After his wife came to comfort him, Lilly confirmed that he was unharmed.

Such is the unconventional, complex chemical history of ketamine, a form of which the Food and Drug Administration approved this week as the first new type of antidepressant in decades. A nasal spray known as esketamine holds great promise for people with treatment-resistant depression, researchers say.

That’s only the latest use for the well-traveled drug.

Ketamine, first synthesized by a Detroit chemist in 1962, has been used as a combat zone anesthetic, an emergency room painkiller and a surgical sedative for horses. And for decades, it has also been a recreational drug, embraced by trip-seekers from the counterculture to the club scene.

By the early 1970s, the drug known as “Special K,” among other street names, had found a foothold among the growing number of LSD and hallucinogenic enthusiasts. It appeared in the pages of “The Fabulous Furry Freak Brothers” and other journals of the psychedelic age, grew in popularity, and remained a fixture into the rave movement. What its users sought was a version of the mind-body detachment effect that made it so welcome to wounded U.S. troops in Vietnam, who were its first medical users.

“Its dissociative properties were extreme,” said Tom Shroder, a former Washington Post editor and author of “Acid Test: LSD, Ecstasy and the Power to Heal.” He noted that several of the old recreational hallucinogens are now vying for new therapeutic cred.

“This is the first of the psychedelics to reach prescription status,” Shroder said. “There are a lot coming up behind it: psilocybin, MDMA [ecstasy], LSD.”

The federal government classified ketamine as a Schedule III controlled substance in 1999 in a futile effort to stop its recreational use. But in the research realm, its reputation continued to grow.

The drug has had many champions, including a recent generation of psychiatrists who have agitated for some version of it to be approved for the treatment of depression. But probably no one had a stranger history with the substance than Lilly, who was from a wealthy family from St. Paul, Minn., and had degrees in medicine and psychoanalysis.

The author of almost 20 books, he was the polymath contributor to fields including electro-neurobiology and gas pressure measurement. Lilly is credited with coining the phrase “human biocomputer,” a widely embraced metaphor of the brain as hardware and the mind as software. Leary once called his friend “a veritable Isaac Newton of the mind.”

He was also, like Leary, an enthusiastic “psychonaut,” embracing a variety of consciousness-expanding drugs in a metaphysical quest to understand the greater meaning of being. Lilly’s experience with LSD, which he described in his book “Center of the Cyclone: An Autobiography of Inner Space,” was less than positive. He had more enthusiasm for ketamine, devoting several chapters to the drug in his 1988 book, “The Scientist: A Metaphysical Autobiography.”

The drug figured in both of Lilly’s most notable works: his groundbreaking advocacy for dolphins and other cetaceans as being near-peers of humans in terms of intelligence, and his invention of the isolation tank.

He began to develop the latter in the 1950s, a dark, soundproof enclosure half filled with saline water meant to deprive a person of all external stimulus so deeper levels of the unconscious mind could emerge. In later years, he spent hours inside, carefully noting his reaction to various doses of ketamine. Lilly’s experience forms the basis of the novel and film “Altered States.”

He also used the drug in his many encounters with marine mammals, a project he worked on for decades until his death in 2001 at age 86. Lilly wrote multiple books on his belief that dolphins were capable of communication, something now widely accepted, and his goal of creating a common language with them. His work began with dissecting their brains, then connecting probes to their skulls while they were alive. Finally, in the 1960s, he and his associates were spending days with them in a lab in the Caribbean, hoping to teach them human speech. The work was funded in part by NASA; the research intrigued Carl Sagan and astrophysicists, who thought it might apply to future contact with extraterrestrials.

That project foundered over reports that the animals were being abused, including being injected with LSD. But Lilly would spend years trying to bridge the interspecies gap, often with the help of ketamine, a drug that has been many places and come a long way.

Read more Retropolis:

The Beatles played on a London rooftop in 1969. It wound up being their last show.

The day anti-Vietnam War protesters tried to levitate the Pentagon

How Aretha Franklin’s ‘Respect’ became an anthem for civil rights and feminism

Robert Frost wrote this masterpiece in about 20 minutes. It belongs to all of us now.