The Sri Lankan navy undertook the 12-hour rescue after spotting the elephant struggling to stay afloat several miles off the coast. (Photo: Caters News)

For members of the Sri Lankan navy, a routine morning patrol took an unexpected turn on Tuesday when an elephant was spotted struggling to stay afloat after having been pulled miles off the coast by currents.

Slideshow: Sri Lankan navy rescues stranded elephant miles off the coast >>>

When naval personnel said it spotted the elephant eight miles from the shore, the animal was struggling to keep just its trunk above the waves while the rest of its body was underwater. Navy divers then tied ropes to the elephant and called for two additional boats to help gently pull it back to shore in what became a 12-hour rescue mission.

Sri Lankan navy divers try to tie a rope around an elephant that had strayed into the open sea and was struggling to stay afloat. (Photo by Sri Lanka Navy Media Unit HA/REX/Shutterstock)

It is not unusual for elephants to swim long distances, Avinash Krishnan, a researcher for the Indian animal conservation group A Rocha, told the Guardian, but they tire quickly.

“And the saltwater isn’t good for their skin, so in this case, the situation probably warranted human intervention,” Krishnan said.

Sri Lankan navy divers tie a rope around an elephant that had strayed away into the open sea. (Photo by Sri Lanka Navy Media Unit HA/REX/Shutterstock)

After the “dramatic rescue at sea,” as described by the Sri Lankan navy on its website, naval personnel gave the elephant to wildlife officials before releasing it back into the wild.

A group of naval personnel attached to the Eastern Naval Command saved an elephant caught in a current in the seas about 8 Nm off Kokkuthuduwai, Kokilai. (Source: maps4news/Sri Lanka Navy/Yahoo News)

“They usually wade through shallow waters or even swim across to take a shortcut,” said Sri Lankan navy spokesperson Chaminda Walakuluge. “It is a miraculous escape for the elephant.”

Sri Lankan navy divers attempt to rescue the elephant. (Photo by Ari Lanka Navy Medical Unit HA/REX/Shutterstock)

Read more from Yahoo News: