Ted Stanley, creator of the fentanyl lollipop. (University of Utah Health)

Ted Stanley, whose sugary creation — the fentanyl lollipop — has helped millions of cancer patients alleviate severe pain, while also enabling opioid addicts across the country to receive a quick and sometimes lethal fix, died July 13 in Salt Lake City. He was 77.

A son, also named Ted Stanley, said the cause was complications from prostate cancer.

Dr. Stanley, a professor of anesthesiology at the University of Utah, played a leading role in popularizing the medical use of fentanyl. Synthesized by chemist Paul Janssen in 1960, the drug is a potent opioid, about 100 times stronger than morphine, used for general anesthesia and pain relief.

About 6.5 million fentanyl prescriptions were dispensed in the United States in 2015, administered through sprays, tablets, patches, injections and a lollipop-like lozenge that Dr. Stanley and a colleague patented in 1985.

Fentanyl is widely used in cardiac procedures and other operations, and its potency — and relatively low price — have contributed to its use in everything from bags of heroin to military operations.

A prototype and the packaging for Actiq, a fentanyl lollipop created by Ted Stanley’s company Anesta. (AP)

Russian special forces were accused of using gaseous carfentanil, an extremely potent form of the drug, during a 2002 hostage-rescue operation at a Moscow theater, resulting in the deaths of several dozen Chechen militants and more than 120 hostages.

In the United States, fentanyl has been found in narcotics such as heroin and counterfeit OxyContin pills. Some illicit users know Dr. Stanley’s creation not by its brand name, Actiq, but as perc-a-pop, a name suggestive of the painkiller Percocet.

While Dr. Stanley is best known for his lollipop-like creation, he played a crucial role in bring opioids “into widespread use in anesthesia,” said Talmage Egan , chair of the University of Utah’s anesthesiology department. Before the mid-1970s, he said, anesthesiologists mainly used gases — which fail to offer significant pain relief — or morphine, which can cause low blood pressure and other cardiovascular problems.

Today, most anesthesiologists use gas and opioids at the same time.

Dr. Stanley was studying the use of opioid-packed darts to immobilize moose, elk and other big-game animals when he developed the idea of a fentanyl lollipop for children and adults. While working with a group of rhesus monkey test subjects, a colleague in California suggested injecting carfentanil into a sugar cube.

“Monkeys like sugar cubes,” Dr. Stanley told the Salt Lake City radio station KUER in 2010, “and the monkeys loved this.”

Shortly after the sugar cube test, Dr. Stanley was on an airplane flight when he “wondered if something similar . . . could be developed for human patients, especially children, experiencing severe stress and anxiety prior to surgery.”

The result was the fentanyl lollipop, a raspberry-flavored lozenge on a plastic stick, which Dr. Stanley developed with his colleague Brian Hague. The drug was noninvasive and needle-free, and functioned faster than a pill; going through tissue inside the mouth, it was absorbed straight into the bloodstream.

The University of Utah’s business school encouraged him to start a company to sell his fentanyl lollipops. Dr. Stanley, who said he “didn’t know did-squat” about business, hesitated before joining with businessman Bill Moeller to co-found Anesta, the first of several pharmaceutical companies Dr. Stanley went on to create.

The company’s first product, Oralet, was aimed at children but failed to catch on. That changed with Actiq, a similar drug for adult cancer patients who suffered from “breakthrough pain” — occasional pain that other powerful opioids failed to quell.

Actiq was approved by the Food and Drug Administration in 1998 and, in a nod to consumer groups who protested that the medicine could be mistaken for candy, sold in heavy foil packaging to deter children.

Theodore Henry Stanley was born in Manhattan on Feb. 4, 1940, and grew up in Brooklyn. His father was a New York City policeman, and his mother was a corrections officer.

He played nine instruments in high school, where he was also captain of the baseball team and aspired to play center field in the major leagues. Four years at Columbia University, where he played on the varsity squad and unsuccessfully tried out for the Brooklyn Dodgers, persuaded him to switch from sports to medicine.

Dr. Stanley graduated in 1961 with bachelor’s degrees in zoology, chemistry and music, and remained at Columbia for medical school. He studied under Dutch physician Willem J. Kolff while doing a fellowship at the University of Utah and, in 1982, he worked with Kolff on the surgical team that implanted the first artificial heart in a human.

Dr. Stanley joined the Utah faculty in 1972, and remained at the school until his death.

His first marriage, to Mary Ann Owen, ended in divorce. Survivors include his wife of 14 years, the former Susan Clark; two children from his first marriage, Tim and Ted; two stepchildren, Taylor and Brecca ; a brother; and three grandchildren.

Anesta was acquired by Pennsylvania-based Cephalon in 2000, and later investigated by the FDA over its marketing of Actiq and other drugs. While Actiq had only been authorized for use in cancer patients who were already using opioid painkillers, Cephalon allegedly promoted the drug as a treatment for migraines and other conditions. The company agreed to a $425 million settlement in 2008.

In recent years, Dr. Stanley lamented fentanyl’s increasing role in the drug trade. Pointing to the ease with which fentanyl can cause an overdose — several milligrams, the equivalent of a pinch of salt, are considered a fatal dose — he told the Courier-Post in New Jersey that using drugs purchased on the street was “like playing Russian roulette. You put the gun in your mouth and you have a 1-in-6 chance of dying.”

“Carfentanil,” which is sometimes used to lace heroin, “is like a 5-in-6 chance of dying,” he said. “And fentanyl is like maybe a 2-or-3 out of 6 chance.”