For the past nine years, some of America's biggest producers of fresh salad greens and vegetables have been waging a quiet war on wildlife surrounding their fields, all in an effort to keep your veggies free of contamination from disease-causing bacteria.

Now, a fresh analysis of safety data suggests that the effort is mostly in vain. Clearing away wildlife habitat does not make food any safer.

The battle started with the great spinach scare of 2006. Bagged spinach from a farm in California sickened 200 people around the country, and three of the victims died.

Investigators went looking for the source of the contamination. They found a matching strain of disease-causing E. coli bacteria in cattle living a mile or so from the farm — and among some wild pigs living nearby.

"The wild pigs were sort of the kicker," says Daniel Karp, a researcher at the University of California, Berkeley. "That led the industry to suspect that wildlife were playing a major role in bringing these pathogens into the farm."

Ever since, farmers have been getting rid of any places near their farms where wildlife might hide. They've torn out trees, cleared stream banks and created wide strips of bare earth all around their fields.

Environmentalists have been complaining that all this habitat destruction is based on fear, rather than scientific evidence of any risk to food safety.

Karp, who is also affiliated with The Nature Conservancy, an environmental group, decided to look at the evidence. He and a group of colleagues analyzed thousands of test results from fresh produce from dozens of farms.

They found that vegetables that grew near wildlife habitat were not more likely to be contaminated with disease-causing bacteria. "In fact, you see no relationship. You do not see that farms that are near habitat have any elevated levels of these pathogens," he says.

Actually, as some farms cleared away wildlife habitat, contamination with E. coli became more common. "So not only was it not working, it in fact looked like it was making food less safe," Karp says.

Karp has a couple of theories for why this might be the case. It's possible, he says, that natural vegetation actually plays a role in protecting fields from contamination, by filtering runoff from fields where cattle have grazed.

The study was published this week in the Proceedings of the National Academy of Sciences.

Trevor Suslow, a food safety expert at the University of California, Davis, says he's not totally convinced by all the claims in the new study. According to Suslow, there are probably several reasons why disease-causing E. coli have turned up more frequently in fresh produce in recent years. Changes in the way that companies test for these pathogens may be more important than any destruction of wildlife habitat.

But he agrees with Karp that there's little evidence that removing wildlife habitat actually makes food safer. Several other researchers are coming to similar conclusions, and the industry is reacting. Safety requirements are changing.

"There's a lot more emphasis on actual visual evidence of animal intrusion into a field, as opposed to the presence of habitat, or animals, surrounding that field," he says.

Copyright 2016 NPR. To see more, visit http://www.npr.org/.