Updated

A Danish yachting family held hostage by Somali pirates for more than six months has been released and is returning home after enduring "the most horrible ordeal one can imagine," government officials said.

Jan Quist Johansen, his wife Birgit Marie and their three teenage children were captured along with two Danish crew members on Feb. 24 as their 43-foot (13-meter) yacht was seized by pirates in the Indian Ocean.

All seven "were released Tuesday and are doing well under the circumstances. They are in a plane on their way to Denmark," Foreign Ministry spokeswoman Charlotte Slente said.

She declined to comment further on the circumstances of the release and wouldn't say whether a ransom had been paid.

The Johansens, from Kalundborg, 75 miles west of Copenhagen, were on a round-the-world journey when they approached the pirate-infested waters off the Horn of Africa. Their travel blog showed they were aware of the dangers but didn't expect to get into trouble, and were comforted by the sight of anti-piracy forces patrolling the vast area.

News of their release was met with relief in their home town.

"The family very likely is aware that what they did was not so fortunate. They certainly feel pretty bad about it now," said Ole Meridin Petersen, chairman of the Kalundborg yacht club, in which Jan Quist Johansen was a member.

Hostages are held in hot, austere conditions in Somalia -- typically for many months -- before a ransom is agreed on and paid, and the hijacked ships and crew are released. Last year, a British sailing couple were released after 388 days in captivity. Reports indicated that a ransom in the region of $1 million was paid for their release.

Danish Foreign Minister Lene Espersen told Danish news agency Ritzau that Denmark doesn't pay ransom "as a matter of principle," adding it was the family, not the Foreign Ministry, that had been negotiating with the pirates. The family was "advised by professional negotiators," she said.

Prime Minister Lars Loekke Rasmussen said negotiations carried on for "a long period" before the hostages were freed.

"I am really happy on behalf of the family, which since Feb. 24 has been through the most horrible ordeal one can imagine," Loekke Rasmussen said. "It is important that we now give the family quiet and peace."

The Foreign Ministry said two Danes and four Filipinos from Danish cargo ship M/V Leopard are still being held by Somali pirates after the vessel was attacked off Somalia on Jan. 12, 2011.

Somalia hasn't had a functioning government since 1991, one of the reasons the piracy trade has flourished.