Four Thai fishermen held hostage by Somali pirates for nearly five years have been released, local officials said.

"We collected the four Thailand men from a remote area," Omar Sheikh Ali, an official in Somalia's central Galmudug administration told the AFP news agency on Friday.

The four fishermen were among 24 crew members seized in April 2010 when Somali pirates hijacked the Taiwan-flagged fishing vessel FV Prantalay 12.

Their nearly five-year captivity is one of the longest suffered by any victims of Somali piracy.

Ali said the freed men were able to contact family members soon after their release on Wednesday.

"They called their families by phone and cried and cried and cried," he said.

Residents of Galkayo, where the Galmudug administration is based, said a $150,000 ransom was paid but the information could not be independently verified.

After its capture the FV Prantalay was used as a pirate mother ship to launch attacks far out to sea before it capsized in July 2011 and the crew was taken ashore.

Of the original 24 crew members, six died from sickness at various stages during their captivity.

Another 14 crew from Myanmar were released to the government in the Somalia's northern Puntland region in May 2011 and repatriated by the United Nations Office on Drugs and Crime (UNODC) Hostage Support Programme.

Piracy off the coast of Somalia reached its height in 2011 when there were 237 incidents attributed to Somali pirates and 28 vessels hijacked.

But a combination of armed onboard guards and international naval patrols have had a big impact and last year there were no successful hijackings, according to the International Maritime Bureau which tracks piracy incidents worldwide.