Somali pirates have freed a German-American journalist two and a half years after he was kidnapped in the semi-autonomous Puntland, officials have said.

Ahmed Muse Nur, a governor in the region, said Michael Scott Moore was handed to authorities on Tuesday. The AFP news agency quoted an unnamed Somali pirate source as saying that a ransom was paid for his release.

In Berlin, a German foreign ministry spokeswoman confirmed "that a German citizen, who also has US citizenship and who was abducted in Somalia, went free today".

The 45-year-old Moore had worked for Der Spiegel in Berlin before he travelled to Somalia to write a book on piracy.

At their peak in January 2011, Somali pirates held 736 hostages and 32 boats, some onshore and others on their vessels.

According to security sources, about 40 foreign nationals, most of them fishermen unable to pay ransoms, are still being held.

Pirate attacks off Somalia have been cut in recent years due to international fleets patrolling the Gulf of Aden and Indian Ocean, and armed guards are now posted aboard many vessels.