Somali pirates who hijacked a UN-chartered ship carrying food aid for tsunami victims more than three months ago abandoned the vessel on Sunday and allowed its crew to sail to freedom, officials involved in the saga said.

The gunmen, who seized the MV Semlow on June 27 and rejected the World Food Programme's (WFP) demands for its unconditional release, left the ship on Sunday afternoon as it was being towed by a second hijacked ship, said Karim Kudrathi, director of the Mombasa-based Motaku Shipping Agency which owns the vessel.

"With the intervention of the Somali businessman, something good happened today," he said.

"The pirates left the ship today," said Andrew Mwangura of the Seafarers' Assistance Program in Mombasa.

Peter Smerdon, a WFP official in Nairobi, said his agency understood the hijackers had left the ship at Markaa, half way between their base in Haradere, about 300 kilometres (185 miles) north of Mogadishu, and the port of El-Maan, about 35 kilometers (25 miles) north of the capital.

The MV Semlow – registered in St Vincent and the Grenadines – which had run out of fuel and was being towed by the MV Ibn Batouta, hijacked by the same pirates on September 24, were reportedly freed after an agreement was struck between the gunmen and the Somali owner of the cement cargo on the second vessel.

"The port authority in El-Maan says it's on its way," Smerdon told AFP.

Over the months of the saga, the pirates frequently changed their ransom demands and reneged on arrangements with the WFP.

According to the International Maritime Bureau, almost two dozen incidents of piracy were reported off the Somali coast since mid-March.