Two goats leased by Harvard’s Arnold Arboretum in Boston for plant control were attacked by an off-leash dog that jumped over an electrified enclosure Wednesday afternoon, the organization announced.

The two animals did survive, but were taken off-duty for veterinary treatment, staff said.

The Arboretum employs four goats in its Peters Hill landscape to help control weeds and other invasive plants.

The approach, while seemingly unique for an urban environment, is an often cost-effective and greener method for maintaining property.

“This unfortunate and violent incident illustrates the potential dangers caused by dog owners who allow their animals to roam off-leash at the Arboretum, a violation of the law as well as park regulations,” the Arboretum said in a statement. “In addition to incurring injuries to staff, pedestrians and bicyclists, off-leash dogs also pose threats to leashed dogs and wildlife species in the landscape.”

The staff is asking anyone enjoying the park to help ensure the safety of the goats by keeping their dogs leashed at all times, while also reporting any off-leash dogs to Boston Animal Control or Boston Police.