Twenty-two hostages seized by pirates nearly three years ago have been freed, the authorities in Somalia's semi-autonomous region of Puntland say.
They said their maritime force began the operation to free the hostages - and their ship - nearly two weeks ago.
The hostages are showing signs of having suffered physical torture and illness, their statement said.
Successful pirate attacks off the coast of Somalia have decreased in the last two years.
This is due to the increased use of private security guards on ships and better co-ordination between naval patrols in the area, the BBC's Mary Harper says.
It is rare for Somali forces to move on pirates in this way, our correspondent says.
The Panama-flagged MV Iceberg One was seized off the Yemeni coast in 2009, and was being held near Gara'ad village on the coast in Mudug region when Puntland's maritime troops surrounded it on 10 December.
In their statement, the Puntland authorities said their troops fought the pirates for two weeks before safely rescuing all 22 hostages on board the ship.
They also killed a number of pirates after intercepting one of their small boats delivering weapons and other supplies to the captured ship.
"After two years and 9 months in captivity, the hostages have suffered signs of physical torture and illness," the statement said. "[They] are now receiving nutrition and medical care."