Three migrants who arrived in Spain after enduring an 11-day journey from Nigeria on the rudder of a fuel tanker were returned to the ship Tuesday after receiving medical care, officials said.

The men were found when the Alithini II docked in Las Palmas on the island of Gran Canaria on Monday evening.

A photo shared on social media by the Spanish coastguard shows them sitting on the rudder of the oil tanker's stern, their feet just above the waterline.

"They were tired and had symptoms of hypothermia and when they arrived at the port they were attended by health services," the coastguard said in a statement.

Local emergency services said the three men were dehydrated and needed hospital care.

The three migrants were on Tuesday returned to the Maltese-flagged ship, which will have to take them back to Nigeria, a spokesman for the central government's representative in the Canary Islands told AFP.

A ship's operator must take care of any stowaways and "has to bring them back to their port of origin", he said.

"If there are stowaways on a plane, the airline is responsible for them," he added.

Officials gave no details about the nationality of the migrants or if they had requested asylum in Spain.

The Alithini II departed Nigeria's largest city Lagos for Las Palmas -- a journey of over 2,700 nautical miles -- on November 17, according to maritime tracking websites.

Spain's Canary Islands, located in the Atlantic off the northwest coast of Africa, are a popular gateway for migrants attempting to reach Europe.