Dec. 4, 2013 -- Some may tout marijuana as a safe, recreational drug with valuable medicinal properties, but toke up your joint and it likely contains mold, pesticides, even dead insects, according to researchers at the University of New Haven in Connecticut.

In their genetic studies of marijuana, the researchers found a variety of nasty byproducts in the plant: fungi, mildew and even such bacterial contaminants as e-coli and salmonella.

Much of it could be seen with the naked eye on the surface of plants, said Heather Miller Coyle, a forensic botanist and associate professor at the university, who has built a DNA database of different types of marijuana that has helped federal law enforcement learn where illegal pot growers and dealers get their product.

Now she has turned her attention to public health and is urging states where marijuana is legal to pass strict certification laws.

Marijuana is a controlled substance that is illegal under federal law. But in states where it is used legally for medicinal purposes, there is limited testing, and the testing that is done is for medical potency, not purity.

"Every other medicine out there is controlled and monitored for quality and not administered in a smokable format," Coyle told ABCNews.com.

"There's a lot of concern about the way these forms of medical marijuana are grown," she said. "A lot of the time, they are grown in a noncertified fashion, especially in California.

"They are grown in open fields or illegally on federal park lands," she said. "Pesticides are dumped on them to prevent damage and increase yield. Some are grown between crops of different species, and chickens are running around and fertilizers are being used.

"They are grown in the wild by people and are not certified by anyone," said Coyle. "What would the effect be on a person who is immune compromised or seriously ill?"

Colorado and Washington are first states to legalize recreational marijuana.

Coyle said potential health hazards could include allergic reactions, especially in the inhalation of molds or spores.

"In a normally healthy person, that might not matter, but for someone who is immune compromised, it could cause inadvertent death," she said.

Chemicals might also be toxic if smoked. Newer herbal blends made with synthetic THC, the psychoactive ingredient in marijuana, are also worrisome, said Coyle.

Jewish rabbi ties faith to medical marijuana dispensary.

For the past five years, Coyle's research has been funded by a $100,000 grant from the U.S. Office of National Drug Control Policy's High Intensity Drug Trafficking Areas program. She and her students have developed a bar-coding system to identify the different varieties of marijuana and to study its genetic foundation. The system helps to detect contaminants and could be widely used to test medical marijuana.

"The health hazards have not been fully investigated, and it's not being grown in controlled greenhouse environments with state regulations and safety visits," she said. "Medical marijuana is of great concern because of claims that it has medicinal value."

National advocates for legalization such as the Washington, D.C.-based Marijuana Policy Project support efforts to certify product safety.

"Our mission is to end marijuana prohibition and to replace it with a system that regulates marijuana like alcohol," spokesman Mason Tvert told ABCNews.com. "In some sense, you could say our goal is to ensure that marijuana is being tested."

Medical marijuana is legal in 20 states and in Washington, D. C., but safety regulations vary. In states such as Washington and Colorado, where pot is now sold openly in stores, legislators are for the first time putting more rigid testing requirements in place.

Since the legalization of limited amounts of medical marijuana in Colorado in 2000, the state has had no requirements for testing -- it was all voluntary, according to Genifer Murray, CEO of Cannlabs, a private testing company.

"The only reasons for testing have been to market [marijuana] -- to say you have a high THC plant," Murray told ABCNews.com.

She said that in addition to microbes, such as e-coli and salmonella, testers have found resident solvents in hashish, which is made from the resin and other fragments of cannabis.

"When you take the flower of the plant to make hash you need to use a solvent – it can be water, CO2 or alcohol," she said. "All those are safe. But then you have hydrocarbons like butanes and propane."

When Colorado voters approved legalization of marijuana for recreational use in 2012, labs were required to test for residual solvents and perform microbe testing for molds, mildew, salmonella and e-coli, she said. Pesticide testing will be required in 2014.

But so far, the law applies only to marijuana sold in stores to those over the age of 21, not to medical marijuana.

"Since there has been no regulation, there have been a lot of backseat labs and mobile labs with no chemistry who don't know what they are doing," Murray said.

"To be honest – it's absolutely awful," said Murray. "Only about 7 percent of the market is tested. It's very expensive and no one wants to pay for it. But now, it is going to be mandated and they are adding other tests."

Colorado only allows marijuana to be grown in the state, mostly in large warehouses and greenhouses. "Colorado has some of the best genetics in the country," she said.

But even so, mold can grow in hot summer temperatures if air conditioning fails, or if the plants are transported to dispensaries in containers that are humid.

"The last thing we want to do is preach it won't kill you, and then have someone die of contaminated cannabis," said Murray.

Researcher Coyle said that the federal government already had the technology to test agricultural products for potentially dangerous contaminants.

"The food industry has had it for a long time for salmonella outbreaks on eggs and lettuce," she said. "If states are going to allow [marijuana], they should have controlled facilities and monitor those facilities and report to the federal government so there is some measure of safety."