MOGADISHU, Somalia (AP) — US Navy SEALs parachuted into Somalia under cover of darkness early Wednesday and crept up to an outdoor camp where an American woman and Danish man were being held hostage. Soon, nine kidnappers were dead and both hostages were freed.

President Barack Obama authorized the mission by SEAL Team 6 two days earlier, deploying the same unit that killed Osama bin Laden last year. Minutes after the president gave his State of the Union address to Congress he was on the phone with the American’s father to tell him his daughter was safe.

The raiders came in quickly, catching the guards as they were sleeping after having chewed the narcotic leaf qat for much of the evening, a pirate who gave his name as Bile Hussein told The Associated Press by phone. Hussein said he was not present at the site but had spoken with other pirates who were, and that they told him nine pirates had been killed in the raid and three were ‘‘taken away.’’

The hostage rescue was carried out by the same SEAL unit behind the operation in Pakistan last May that killed bin Laden, two US officials said on condition of anonymity to discuss the operation. It was not clear if any members participated in both operations. The unit is the Naval Special Warfare Development Group, also known as SEAL Team 6.

One official said that the team parachuted into the area before moving on foot to the target. The raid happened near the Somali town of Adado.

New intelligence emerged last week that Buchanan’s health was ‘‘deteriorating rapidly,’’ so Obama directed his security team to develop a rescue plan, according to a senior administration official who was not authorized to speak publicly. A Danish Refugee Council official, Mary Ann Olsen, said that Buchanan was ‘‘not that ill’’ but needed medicine.

‘‘As Commander-in-Chief, I could not be prouder of the troops who carried out this mission, and the dedicated professionals who supported their efforts,’’ Obama said in a statement released by the White House. ‘‘The United States will not tolerate the abduction of our people, and will spare no effort to secure the safety of our citizens and to bring their captors to justice.’’

A Western official said the rescuers and the freed hostages flew by helicopter to a US military base called Camp Lemonnier in the Horn of Africa nation of Djibouti. Both officials spoke on condition of anonymity because the information had not been released publicly. Defense Secretary Leon Panetta visited Camp Lemonnier just over a month ago. A key US ally in this region, Djibouti has the only US base in sub-Saharan Africa. It hosts the military’s Combined Joint Task Force-Horn of Africa.

The timing of the raid may have been made more urgent by Buchanan’s medical condition. The Danish Refugee Council had been trying to work with Somali elders to win the hostages’ freedom but had found little success.

‘‘One of the hostages has a disease that was very serious and that had to be solved,’’ Danish Foreign Minister Villy Soevndal told Denmark’s TV2 channel. Soevndal did not provide any more details. Soevndal congratulated the Americans for the raid.

The Danish Refugee Council said both freed hostages are unharmed ‘‘and at a safe location.’’ The group said in a separate statement that the two ‘‘are on their way to be reunited with their families.’’

Pete Souza/White House/Ap Photo

After yesterday’s State of the Union address, President Barack Obama, accompanied by first lady Michelle Obama, informed John Buchanan that his daughter Jessica was rescued by US Special Operations Forces in Somalia.

Olsen informed Thisted’s family of of the successful military operation and said ‘‘they were very happy and incredibly relieved that it is over.’’ Olsen said the two freed hostages were in Djibouti and would soon be moved to a ‘‘safe haven.’’ She said Buchanan does not need to be hospitalized.

‘‘One of the first things Poul and Jessica were able to do was to call their families and say they were freed,’’ Olsen said. ‘‘They will be reunited with their families as quickly as possible,’’ Olsen said.

The head of the Danish Refugee Council, Andreas Kamm, said he would have preferred to see the two hostages freed peacefully after working with Somali groups to win the pair’s freedom, ‘‘but we’re happy with the outcome. This is a day of joy indeed.’’

The two aid workers appear to have been kidnapped by criminals — sometimes referred to as pirates — and not by Somalia’s al-Qaida-linked militant group al-Shabab. As large ships at sea have increased their defenses against pirate attacks, gangs have looked for other money making opportunities like land-based kidnappings.

The Danish Refugee Council had earlier enlisted traditional Somali elders and members of civil society to seek the release of the two hostages.

‘‘We are really happy with the successful release of the innocents kidnapped by evildoers,’’ said Mohamud Sahal, an elder in Galkayo town, by phone. ‘‘They were guests who were treated brutally. That was against Islam and our culture ... These men (pirates) have spoiled our good customs and culture, so Somalis should fight back.’’

Buchanan lived in neighboring Kenya before Somalia, and worked at a school in Nairobi called the Rosslyn Academy from 2007-09, said Rob Beyer, the dean of students. He described the American as quick to laugh and adventurous.

‘‘There have been tears on and around the campus today,’’ Beyer said. ‘‘She was well-loved by all her students.’’

Buchanan graduated in 2006 from Valley Forge Christian College, a small suburban Philadelphia school. The school’s president, the Rev. Don Meyer, said Buchanan taught at Rosslyn as part of her studies and ‘‘fell in love with Africa.’’

‘‘Ever since Jessica was captured, we all as a community have been praying for her safety and for her safe release,’’ Meyer said. ‘‘We are also grateful that our prayers have been answered.’’

Buchanan and Thisted were seized in October from the portion of Galkayo town under the control of a government-allied clan militia. The aid agency has said that Somalis held demonstrations demanding the pair’s quick release.

Their Somali colleague was detained by police on suspicion of being involved in their kidnapping.

The two hostages were working in northern Somalia for the Danish Demining Group, whose experts have been clearing mines and unexploded ordnance in conflict zones in Africa and the Middle East.

Several hostages are still being held in Somalia, including a British tourist, two Spanish doctors seized from neighboring Kenya, and an American journalist kidnapped on Saturday.

BostonGlobe.com complimentary digital access has been provided to you, without a subscription, for free starting today and ending in 14 days. After the free trial period, your free BostonGlobe.com digital access will stop immediately unless you sign up for BostonGlobe.com digital subscription. Current print and digital subscribers are not eligible for the free trial.

Thanks & Welcome to Globe.com

You now have unlimited access for the next two weeks.

BostonGlobe.com complimentary digital access has been provided to you, without a subscription, for free starting today and ending in 14 days. After the free trial period, your free BostonGlobe.com digital access will stop immediately unless you sign up for BostonGlobe.com digital subscription. Current print and digital subscribers are not eligible for the free trial.