WASHINGTON — The secret was still intact when President Obama, entering the House chamber Tuesday evening to deliver his State of the Union speech, pointed at his Pentagon chief and said, “Good job tonight.”

Unknown to a global television audience watching the annual Capitol Hill ritual, a bold US raid was still playing out half a world away with an elite Navy SEAL team’s rescue of two hostages in Somalia, one of them an American. It was the same unit that killed al Qaeda leader Osama bin Laden, two US officials said Wednesday.

Publicly, Obama did not tip his hand during his speech, though microphones picked up his congratulation to Defense Secretary Leon Panetta as he entered the House chamber. Obama pointed his index finger to Panetta and said, “Good job tonight. Good job.” Panetta smiled broadly.

Obama had learned shortly before that American aid worker Jessica Buchanan and Poul Hagen Thisted, a Dane, were safely in US military hands. Immediately after the speech, Obama telephoned Buchanan’s father from the Capitol to tell him that she was safe and “on her way home,” according to the White House.

A Pentagon spokesman, Navy Capt. John Kirby, said that although the two hostages were safe by the time Obama gestured to Panetta, the secretive rescue mission had not yet been completed.

Kirby and other Pentagon officials declined to reveal details of how the rescue was conducted, although they said the Americans originally intended to capture alive and detain the kidnappers. Instead, for reasons that have not been explained publicly, they killed all nine of them.

Panetta’s press secretary, George Little, said the kidnappers were heavily armed, with explosives “nearby.” He said neither the two hostages nor any members of the US assault team were injured.

Little said one factor in deciding to go ahead with the rescue was that Buchanan’s medical condition had been deteriorating. He said it was believed that her condition could be life-threatening. Neither Kirby nor Little would say more about her medical problem or say how the US learned of it getting worse.

In his State of the Union speech the president did not mention the rescue, though he did refer to another successful military operation — the May 2011 killing of bin Laden in Pakistan by Navy SEAL Team 6.

“One of my proudest possessions is the flag that the SEAL Team took with them on the mission to get bin Laden,” Obama said in his speech.

Tuesday’s rescue was carried out by the same SEAL unit that carried out the bin Laden operation, two US officials said, speaking on condition of anonymity to discuss the operation. The unit is the Naval Special Warfare Development Group, also known as SEAL Team 6. The members of the unit who carried out the rescue operation were not the same personnel as those who killed bin Laden, the US officials said.

In a predawn White House statement, Obama praised US Special Operations Forces who rescued Buchanan and the Dane, who had been kidnapped at gunpoint by Somali pirates in October.

“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.

A US official speaking on condition of anonymity to discuss the top secret operation, said the SEAL team parachuted into the area and got to the rescue site on foot. The official said US Air Force special operations planes carried the SEALs to the parachute drop zone, and Army special operations helicopters carried the raiders and their hostages to safety.

Panetta, in a statement, said Buchanan and Hagen Thisted “have been transported to a safe location where we will evaluate their health and make arrangements for them to return home.” He said the two hostages were not harmed during the operation, and no US troops were killed or injured.

“This was a team effort and required close coordination, especially between the Department of Defense and our colleagues in the Federal Bureau of Investigation,” Panetta said.

On NBC’s “Today,” Vice President Joe Biden said the US decided to move after determining that Buchanan’s health “was beginning to decline.”

“We wanted to act,” Biden said.

Obama approved the mission Monday. On Tuesday, Obama’s top counterterrorism adviser, John Brennan, gave the president half a dozen updates on the movement of forces and the progression of rescue operation.

About two hours before Obama was scheduled to begin delivering his State of the Union address, Brennan told him Buchanan and Thisted were safe and in US hands.

After delivering his address, Obama called Buchanan’s father. In his statement Wednesday, Obama said he told John Buchanan “that all Americans have Jessica in our thoughts and prayers, and give thanks that she will soon be reunited with her family.”

“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,” Obama said. “This is yet another message to the world that the United States of America will stand strongly against any threats to our people.”

Biden had high praise for the special forces. “It takes your breath away, their capacity and their bravery,” he said on ABC’s “Good Morning America.” ”These guys and women are amazing.”