A federal court has ordered the Environmental Protection Agency (EPA) to ban a widely used pesticide linked to learning disabilities in children.

The decision said the EPA must prohibit the use of the pesticide, known as chlorpyrifos, within 60 days.

Several environmental groups sued to force the ban, after the EPA under Donald Trump decided to allow farms to continue using the pesticide on food products. That was a reversal of the agency’s policy under Barack Obama, when it had begun the process of banning the chemical.

Seven states and Washington DC also intervened in the case to back a ban.

The court found that studies showed children exposed before birth to low doses of the product, initially developed as a nerve gas during the second world war, had reduced IQ, attention deficit disorder and delayed motor development, yet the EPA “equivocated and delayed” over the years on banning it.

“Over nearly two decades, the US Environmental Protection Agency has documented the likely adverse effects of foods containing the residue of the pesticide chlorpyrifos on the physical and mental development of American infants and children, often lasting into adulthood,” Judge Jed Rakoff wrote in the ruling. “In such circumstances, federal law commands that the EPA ban such a pesticide from use on food products.”

The news was welcomed by environmental groups.

“The court has made it clear that children’s health must come before powerful polluters. This is a victory for parents everywhere who want to feed their kids fruits and veggies without fear it’s harming their brains or poisoning communities,” said Erik Olson, senior director of health and food at the Natural Resources Defense Council, one of the groups behind the lawsuit.

The EPA argues that the evidence of the pesticide’s harmfulness, in a study by the Columbia Center for Children’s Environmental Health, is not conclusive and the researchers have not released the raw data behind their conclusions.

“EPA is reviewing the decision. The Columbia Center’s data underlying the Court’s assumptions remains inaccessible and has hindered the Agency’s ongoing process to fully evaluate the pesticide using the best available, transparent science,” said the EPA spokesman Michael Abboud.