This story was originally published by The Guardian and appears here as part of the Climate Desk collaboration.

A herd of cows has been “potty-trained” in an experiment that scientists say could pave the way for more environmentally friendly farms.

Waste from cattle farms often contaminates soil and waterways and contributes to greenhouse gas emissions and the acidification of soil. For this reason, toilet-training cattle has long been viewed as desirable, but several previous attempts have been unsuccessful.

In the latest study, scientists tried a method they called the MooLoo approach to teach calves to use a toilet area in their barn, meaning that urine could be collected and treated.

“Cattle, like many other animals, are quite clever, and they can learn a lot,” said Jan Langbein, an animal psychologist at the Research Institute for Farm Animal Biology (FBN) in Germany. “Why shouldn’t they be able to learn how to use a toilet?”

The calves were trained via a system of rewards and mild punishments. When they urinated in the assigned area, they were given a sweet drink or some mashed barley, and when they relieved themselves elsewhere, they were surprised by a short blast of water from above.

Within a few weeks, after about 15 training sessions, 11 of the 16 calves in the experiment had been successfully toilet-trained, according to the study published in the journal Current Biology. The five calves who were not reliably trained probably just needed more time to master the skill, the authors suggested. Langbein said a future ambition would be to teach cows to also defecate in a toilet area.

The team is now working to create an automated system that could be used to train calves with almost no intervention from farmers. “We want to develop some kind of sensor technology, which is all-inclusive,” said Langbein. He said that his hope was that “in a few years, all cows will go to a toilet.”

The ammonia produced in cow urine doesn’t directly contribute to the climate crisis, but when it leaches into the soil, microbes convert it into nitrous oxide, which is the third most significant greenhouse gas after methane and carbon dioxide. Agriculture is the largest source of ammonia emissions, with livestock farming making up more than half of that contribution.

According to Langbein, initial estimates suggest that if 80 per cent of cattle urine was collected from a barn, the ammonia emissions would be reduced by more than half.