Garowe Online reported the hostages were freed after a two-week standoff between the pirates holding the Panama-flagged cargo ship MV Iceberg 1 off the coast of Puntland's Mudug region.
"After two years and 9 months in captivity, the hostages have suffered signs of physical torture and illness," a government release announcing the rescue said. "The hostages are now receiving nutrition and medical care."
The release did not provide details of the rescue operation, the news website said.
The Puntland Maritime Police Force had attacked the pirates on Dec. 10. The military killed three pirates and arrested three others as they tried to bring more weapons and ammunition to their comrades in Gaar'ad village days later.