Somali pirates have agreed to release a U.N.-chartered ship and its crew, hijacked nearly three months ago. The ship was carrying food aid to tsunami victims in Somalia.

The U.N.-chartered vessel and its 10-man crew are headed to a port near Mogadishu, says Rene McGuffin, spokeswoman for the World Food Program, the U.N. agency that chartered the ship.

"Our understanding at this point is that the ship is, in fact, moving toward the port of El-Maan, which is just north of the Somali capital of Mogadishu. And we do expect it will arrive there within some three to five days," she explained.

The 10-man crew, including eight Kenyans, a Tanzanian and a Sri Lankan captain, are onboard the vessel, along with the Somali gunmen, says Karim Kudrati, the director for the Motaku Shipping Agency, which owns the hijacked vessel, the MV Semlow.

"They are onboard at the moment. They are doing okay. We have been speaking to them," he said. "And they are coming with the vessel. Once the vessel arrives in El-Maan and off-loads, I hope this is sorted out. This has taken too long, you know, than any other vessel that had been in this problem."

Mr. Kudrati declined to say whether his company would pay the ransom of about $500,000 for the crew that the pirates demanded.

The pirates have been guaranteed safe passage out of El-Maan, says Mr. Kudrati.

The pirates seized the vessel June 27 on its way from the Kenyan port of Mombasa to the Somali port of Bossaso. It was carrying 850 tons of German and Japanese donated rice for thousands of Somalis in need for food aid after the December tsunami.

Port authorities in El-Maan, at the U.N. food agency's request, have agreed to hand over the cargo to Somalia's transitional government, operating out of Jowhar, about 90 kilometers north of Mogadishu.