The crew of the Naham 3, the second longest held hostage by Somali pirates, were taken captive when their Omani-flagged vessel was seized in March 2012 south of the Seychelles.
"We are very pleased to announce the release of the Naham 3 crew early this morning," said John Steed, coordinator of the Hostage Support Partners (HSP) who helped negotiate their release.
Steed, a retired British army colonel who has made it his mission to save "forgotten hostages" told AFP the mission to return the crew to their families still held one obstacle: extracting them from the city of Galkayo, where fighting was raging between forces from the rival regional states of Puntland and Galmudug.
"There is fighting in Galkayo so it is very dangerous at the moment, they are exchanging artillery tonight. We will go in early tomorrow morning if the fighting stops and bring them back to Nairobi for medicals and a clean-up."
Clashes in Galkayo have left at least 11 dead and over 50,000 displaced this month, the UN humanitarian agency said last week.
Once extracted, the crew, from Cambodia, China, Indonesia, Philippines, Taiwan and Vietnam, will be returned to their home countries and families.
"They have spent over four and a half years in deplorable conditions away from their families," said Steed.
He said the crew was malnourished and one of the hostages had a bullet wound in his foot, another had had a stroke and another was suffering from diabetes.
Pirates initially took 29 crew hostage, but one person died during the hijacking, and two more "succumbed to illness" during their captivity, said a statement from Oceans Beyond Piracy (OBP).
Peril and heroism
Steed said negotiations -- which took 18 months -- involved mediation with community, tribal and religious leaders.
He declined to comment on the exact details but said the road to the hostages being freed was filled with peril and "heroism".
The Naham 3 was originally tethered to another hijacked vessel, the MV Albedo, which was seized in November 2010 and released by the HSP in 2014.
When the MV Albedo began to sink "these guys jumped into the waters and rescued the drowning crew", Steed said.
He said when the Naham 3 sank, a year after its capture, "these guys were then taken ashore where they have been ever since with pirates making increasingly irrational demands."
"The release of the Naham 3 crew represents the end of captivity for the last remaining seafarers taken hostage during the height of Somali piracy," he said.
Poor fishermen left for years
Only a crew of Thai fishermen, released in February last year after nearly five years in captivity, spent longer held by Somali pirates.
Many of the hostages left languishing in the hands of pirates are poor fishermen.
"If you do not have insurance or you are a poor little ship no-one is going to help get you out," said Steed.
The first major commercial vessel was hijacked by Somali pirates in 2005 and the industry flourished in a country wracked by years of civil war and with few jobs and no central government.
Piracy became a major threat to international shipping and prompted interventions by the United Nations, European Union and NATO, while commercial vessels hired private armed guards aboard their vessels.
In 2012 Somali piracy cost the global economy between $5.7 and $6.1 billion (5.6 million euros) and at the peak in January 2011, Somali pirates held 736 hostages and 32 boats.
According to the OBP, while overall numbers are down in the Western Indian Ocean, pirates in the region in 2015 attacked at least 306 seafarers.
While there has not been a successful attack on a commercial vessel since 2012, there have been several on fishing boats and there are still 10 Iranian hostages taken in 2015 and three Kenyan kidnap victims -- one a very ill, paralysed woman -- in the hands of the pirates, said Steed.