A dog that was found stranded in the waters of the Gulf of Thailand, about 130 miles from the shore, was rescued by a team of oil rig workers Friday.

The team spotted the dog's head poking above water as it paddled through the ocean. The pooch, which was believed to have fallen from a fishing trawler or jumped into the waters possibly to escape abuse on the vessel, tried to "swim to a pole of the oil platform."

"As wind waves were rather calm that afternoon, we could clearly see its head and water rippling as he was swimming toward our oil platform. If the waves had been strong, we wouldn't have seen him," Vitisak Payalaw, a member of the team wrote on Facebook.

The canine then managed to cling to the pole without making any noise while the team began to devise a rescue plan. They decided to tie a rope around its neck and pull it up.

"We had to race against time as wind waves might sweep him away. Rescue efforts might be difficult if he had been swept away," Payalaw said.

They finally managed to pull up the dog which looked exhausted. The team looked after it and fed it with mineral supplements, after which the canine's condition improved. The team named the dog "Boonrod" which in Thai meant "making a spiritual donation for good luck in the future."

A special cage was welded for the dog, which spent the next two days onboard the oil platform. On Sunday, the dog was lifted by crane onto another vessel, which brought it back to land Monday. Boonrod was then handed over to Watchdog Thailand, a local animal charity, which was trying to check if the dog had an owner.

Speaking to local media, Payalaw said the dog, believed to be between 3 and 5 years old, now had a lot of energy.

A man paddles with his dog on a surf board as people take part in the traditional New Year's sea plunge at Malo-Les-Bains beach in Dunkirk, northern France on 1 January 2016 Philippe Huguen/AFP

"I hope to adopt her as a pet. I am looking forward to spending many happy years together with her," he added.

The Facebook post with the images and videos of the dog has since gone viral with over 22,000 shares. Many users praised and thanked the team for rescuing the dog.

"Thank you all for taking the time to care and rescue this poor girl. Thank you for stopping, making an effort and giving her a new start. From one rescuer to another...thank you," wrote a user.

"A feel good story. Thanks for sharing. Thanks for caring. All the best to Boonrod!" wrote another.

This article originally appeared in IBTimes US.