Cannabis sold on the streets of Spain is contaminated with dangerous levels of fecal matter, a study revealed after testing 90 samples obtained from Madrid.

Traces of E.coli bacteria and the Aspergillus fungus were found by analysts in the cannabis bought in and around the capital city. The study, conducted by scientists at Universidad Complutense in Madrid, including pharmacologist José Manuel Moreno Pérez, will be published in the journal Forensic Science International in May.

According to researchers, 88.3 percent of the total samples collected were not safe to be consumed. Some 40 percent of these also had the odor of feces.

The samples Pérez bought were wrapped in containers in two shapes — “acorns” and “ingots” or blocks, according to the BBC. The study added that cannabis was more likely to be contaminated due to the way it was imported. The “acorns” were the worst offenders, reportedly because of the way they were smuggled into the country.

“Once they arrive in Spain, they take laxatives to expel the acorns. And that’s what goes on sale,” Pérez said.

Researchers also found a link between the shape of the cannabis strain and the contamination levels.

“Foreign elements were found in 64.7 percent of the ingot-shaped samples and in 30.2 percent of the acorn-shaped samples,” researchers said. “With regard to microbiological contamination, 93 percent of acorns were contaminated by E. coli, compared to 29.4 percent of ingots. In addition, all samples with fecal odor were acorns and were contaminated by E. coli.”

According to the study, the risks associated with E.coli and Aspergillus are serious enough to make the illegal street vending of hashish "a public health issue."

An activist rolls a joint during a protest against the prohibition of bearing a minimum dose of marijuana for personal use, in Bogota, Sept. 6, 2018. Getty Images/Raul Arboleda

The E.coli or Escherichia coli infection is caused by the bacteria normally found in the intestines. It can cause diarrhea, vomiting, stomach pains, fever, and blood in feces. It poses a health risk especially for people with severely compromised immune systems.

Aspergillus, a type of mold, also found in the samples, can cause infection in the lung and gastrointestinal diseases. Inhaling Aspergillus mold can cause serious problems for those already having lung conditions, like asthma or cystic fibrosis, or in people who have low immunity. It is particularly dangerous for cancer patients, who sometimes smoke cannabis to help with the symptoms of chemotherapy.

"These patients have a weakened immune system, meaning that an infection caused by the consumption of contaminated or adulterated hashish could be fatal," the study adds.