Chaminda Walakuluge said the navy mounted the 12-hour rescue after spotting the elephant struggling to stay afloat around eight kilometres (five miles) off the island's northeast coast.
Divers aided by wildlife officials approached the distressed animal and tied ropes to it before towing it gently to shallow waters near the coast, where it was released late on Tuesday.
Walakuluge said the animal had likely got swept into the sea while crossing the Kokkilai lagoon, a large stretch of water that lies between two areas of jungle.
"They usually wade through shallow waters or even swim across to take a short cut," he said.
"It is a miraculous escape for the elephant."
The rescue came six weeks after the navy and local residents saved a pod of 20 pilot whales who became stranded in nearby Trincomalee, a natural harbour that is popular for whale watching.
The waters around Trincomalee, which was used by Allied forces as a staging post during World War II, have a high concentration of blue and sperm whales, while the surrounding jungles have herds of wild elephants.
(This story has not been edited by NDTV staff and is auto-generated from a syndicated feed.)
Click for more trending news