Thanks to a team of rescuers, an elephant escaped almost certain death after getting washed out to sea Tuesday in Sri Lanka. The struggling creature was more than five miles out in the open ocean when the Sri Lankan navy sprung into action.

Read: Possible Oldest Elephant Murdered By Poachers For Tusk Ivory

“They usually wade through shallow waters or even swim across to take a shortcut,” Lieutenant Commander Chaminda Walakuluge, told AFP Wednesday. “It is a miraculous escape for the elephant.”

The creature was first spotted trying to keep its trunk above water. In video from the incident, the elephant can be seen almost completely submerged.

In video from the incident, the elephant can be seen struggling to keep its head above water. International Business Times

It took the rescue team, comprised of navy divers and wildlife officials, 12 hours in total to save the elephant. The team tied ropes to the animal and brought it back to shallow water before releasing it.

Walakuluge said the animal was probably trying to cross a nearby lagoon to get to the other side of the jungle when it was swept out to sea. The jungles in the area have large herds of wild elephants that the animal was likely a part of, according to the Straits Times.

But according to some experts, seeing elephants far out in the open ocean isn’t unusual.

Read: 25,000 Elephants Killed By Poachers In Single Sanctuary Park

“They’re very good swimmers,” said Avinash Krishnan, a research officer with the conservation group A Rocha, according to the Guardian. “Swimming about 15km from the shore is not unusual for an elephant. [But] they can’t keep swimming for long because they burn a lot of energy.”