A wild elephant that had been dragged out to sea has been rescued by the Sri Lanka navy, who captured the dramatic moment on camera.

The elephant was rescued about eight nautical miles off the shore of Kokilai, a town on the north-eastern coast of the island nation.

It had been washed out to sea by the current and was spotted by a patrol boat. Navy divers and officials from the department of wildlife were sent to the area to rescue the animal.

Using ropes, the rescuers were able to direct the elephant towards the coast and to safety.

"A group of officials from the Department of Wildlife also joined this humongous task providing necessary instruction which became extremely vital in the rescue mission," the Sri Lankan navy said in a statement.

"Accordingly, they were able to carefully direct the elephant towards the coast from the deep sea, by means of ropes.

"Having safely guided the elephant to the Yan Oya area in Pulmodai, the animal was handed over to the wildlife officials for onward action."

Elephants are good swimmers and use their trunks as underwater snorkels, which allows them to breathe normally when underwater and to swim long distances.