Jorge Silva / Reuters

The story goes that Viagra began as a drug for chest pains. It didn’t work very well. But men in those clinical trials noticed a curious side effect of erections—and lo, a blockbuster drug was born.

Since then, the uses of Viagra, or its non-brand counterpart sildenafil, have continued to morph. Clinicaltrials.gov currently lists 60 planned and ongoing sildenafil trials, and it’s already a common treatment for high blood pressure in the lungs. Until this week, one of the many trials in progress was for pregnant women in the Netherlands whose babies grew too slowly in the womb. But after 11 of those babies died from lung problems after birth, the trial was swiftly terminated, as was a similar one in Canada.

Why was a drug best known for treating erectile dysfunction being tested in pregnant woman at all? There is one answer rooted in biology and another rooted in economics.

On the basic biology: Sildenafil works by relaxing blood vessels and increasing blood flow—hence its effectiveness against erectile dysfunction and high blood pressure in the lungs. In the 2000s, as Viagra was working miracles for men, scientists became interested in how it might help fetuses. In a condition called intrauterine growth restriction, the fetus doesn’t get enough blood and fails to grow. Fetuses that don’t grow can die. The only real treatment hardly seems like a treatment at all: inducing a premature delivery before the fetus dies. If sildenafil could increase blood flow to the fetus, doctors thought, perhaps the drug could help it grow inside the womb.

In 2004, promising animal data led doctors in Canada to pilot a tiny sildenafil study of 10 women. The drug seemed to slightly increase fetal growth, so they drew up plans for a larger, international trial spanning Canada, New Zealand, Australia, the U.K. and the Netherlands. “It was buzzing at conferences,” Wessel Ganzevoort, principle investigator of the Dutch trial told the Dutch newspaper De Volksrant. “Foreign colleagues let slip that they sometimes prescribed [sildenafil], with good results.” (The Dutch trial used a generic version of sildenafil that was not manufactured by Pfizer, the pharmaceutical company that makes Viagra.)

The New Zealand, Australia, and U.K. arms of the trial have already ended, and the U.K. investigators actually published their results in The Lancet in December. The results were not promising. The drug did not prolong pregnancy or improve outcomes. But the trial showed no serious adverse outcomes linked to sildenafil either, so the Dutch and Canadian trials continued until the news of the 11 deaths this week. In a statement, Kenneth Lim, principal investigator of the Canadian trial, said he was unaware of adverse outcomes in Canada but has suspended the trial.

It’s too early to tell exactly what happened, but one specific detail stands out. Amsterdam University Medical Center, which led the Dutch trial, noted in a press release that 93 pregnant women had taken sildenafil in the trial, and that 19 babies had died, 11 possibly of “a form of high blood pressure in the lung”—notable because sildenafil is actually approved to treat high blood pressure in the lungs in adults.

But sildenafil can have the perverse effect of causing the exact problem it’s supposed to solve if patients quit the drug suddenly, says Robert Tulloh, who studies the condition (pulmonary hypertension) at University Hospitals Bristol. The body can acclimate to the drug over time—in the same way that taking steroids can lead to the body producing fewer natural steroids. Now imagine fetuses growing inside women on sildenafil. When they are born, their lungs have to suddenly start working and they are cut off from sildenafil. In addition, says Tulloh, sildenafil affects a very basic cellular pathway in the human body involving nitric oxide. “Even amoebas have nitric oxide capability,” he says. Using the drug during fetal development may have other unintended side effects. (Amsterdam UMC did not immediately respond to questions about the cause of the infant deaths.)

Sildenafil is approved for pulmonary hypertension in adults, but its use in newborns and children is controversial. In 2012, the FDA actually issued a warning about using sildenafil for pulmonary hypertension in children ages 1 to 17. The warning was the result of a long-term trial, where children on high doses of the drug died at markedly higher rates than those on lower doses. But it’s still being used—frequently enough that the FDA had to issue a clarification in 2014 that its warning was not meant to discourage sildenafil in children in all cases. Its use in newborns, particularly premature babies, is also off-label.

Viagra is now sold as a generic, and its popularity as an erectile dysfunction drug means a ready supply is available. “Because it’s so cheap people are using it all sorts of situations,” Tulloh says.

The high cost of drug development has led scientists to repurpose previously approved drugs across diseases. Current trials for sildenafil include everything from cancer, to concussions, to urinary incontinence. The biology and economics of sildenafil are connected.

When a drug can potentially have so many different effects, it also has a lot of side effects—some of them, unfortunately, even deadly.

We want to hear what you think about this article. Submit a letter to the editor or write to letters@theatlantic.com.