Eleven elephants have been saved from ghastly deaths in Cambodia thanks to the collaboration of local villagers and wildlife conservation groups.

People living near the Keo Seima Wildlife Sanctuary in the province of Mondulkiri saw that the pachyderms were trapped in a large pit that a U.S. B52 bomb had originally created, the Cambodia Daily reported on Monday. In more recent years, the local community has been using the crater to store water.

The herd had apparently become stuck in the muddy pit, unable to scale the steep sides, when they wandered in to drink and bathe, according to LiveScience. By the time the local farmers spotted them on Sunday, it was clear they had been there for some time.

WCS Cambodia By the time people found the elephants, they had been stuck for at least a couple of days.

“They obviously had been in there at least a couple of days … because the little baby was very exhausted and the mud was so sticky,” Jemma Bullock of Elephant Livelihood Initiative Environment told Cambodia Daily. She added that the elephants would likely have soon died from exhaustion had people not intervened.

The people who saw the elephants contacted the provincial environmental department, which brought in representatives from ELIE, the World Wildlife Fund, the Wildlife Conservation Society, and Wildlife Alliance Cambodia to help. Staff from those groups teamed up numerous people from the local community to dig into the side of the crater and construct a makeshift ramp for the herd.

Video footage of the rescue (above) shows the elephants making their way up the ramp and walking free. While 10 of them escaped this way, the final elephant — a young one weakened by the ordeal, had to be lifted out using ropes.

Tan Setha of WCS told LiveScience that the deaths of the entire herd ― which included three adult females and eight juveniles — would have seriously hindered conservation efforts in the sanctuary.

“These elephants represent an important part of the breeding population in Keo Seima Wildlife Sanctuary, and their loss would have been a major blow to conservation,” he said.