In a widely expected advance that has opened a fierce debate about “home-brewed heroin,” scientists at Stanford have created strains of yeast that can produce narcotic drugs.

Until now, these drugs — known as opioids — have been derived only from the opium poppy. But the Stanford laboratory is one of several where researchers have been trying to find yeast-based alternatives. Their work is closely followed by pharmaceutical companies and by the Drug Enforcement Administration and Federal Bureau of Investigation.

Advocates of the rapidly advancing field of bioengineering say it promises to make the creation of important chemicals — in this case painkillers and cough suppressants — less expensive and more predictable than using poppies.

In one major advance more than a decade ago, scientists in Berkeley added multiple genes to yeast until it produced a precursor to artemisinin, the most effective modern malaria drug, which previously had to be grown in sweet wormwood shrubs. Much of the world’s artemisinin is now produced in bioengineered yeast.