Five elephants in Malaysia were rescued from a muddy pit in dramatic video released by the country’s Department of Wildlife.

The footage shows the elephants struggling to escape the muddy enclosure, which authorities believe is an abandoned illegal mining pool, according to ABC.

The five elephants were first spotted struggling in the pool by locals. Rescuers spent four hours excavating a path which finally allowed the pachyderms to escape.

“We hope mining operators will be more responsible by covering up disused mining pits or the authorities will take action against those who fail to adhere to the orders,” Department of Wildlife director Rozidan Md Yasin told the country’s New Straits Times.