Updated

President Obama twice authorized the military to rescue a U.S. captain held by Somali pirates and whose life appeared to be at risk.

A senior administration official told FOX News that Obama granted the authority on Friday and Saturday to use appropriate force to rescue Capt. Richard Phillips from a lifeboat off the Somali coast. The Pentagon believed Phillips' life was at risk both times, officials said.

A senior administration official said the president's order authorized force for a group of military assets that arrived at the scene late last week. When more resources arrived, Obama added them to a roster of military personnel allowed to engage militarily with the Somali pirates.

Obama was told Sunday of the rescue while he was in the White House residence, administration officials said. He phoned Phillips and Phillips' family, an official told FOX News.

"I am very pleased that Capt. Phillips has been rescued and is safely on board the USS Boxer," the president said in a statement. "His safety has been our principal concern, and I know this is a welcome relief to his family and his crew."

Obama also praised the U.S. military and the other departments and agencies for their efforts.

"We remain resolved to halt the rise of piracy in this region," he said. "To achieve that goal, we must continue to work with our partners to prevent future attacks, be prepared to interdict acts of piracy and ensure that those who commit acts of piracy are held accountable for their crimes."

A law enforcement official told FOX News that if the Justice Department determines it has enough evidence to charge the pirate currently in custody, the prosecution will take place in New York where the pirate would be transferred within days.

Phillips was in "imminent danger" of being killed by his captors before U.S. Special Operations forces fatally shot them, a U.S. military official said.

Phillips was not hurt in the several minutes of gunfire off the Somali coast Sunday. Phillips was safely transported to a Navy warship nearby.

Three pirates were killed and one surrendered to U.S. forces, said the military official who spoke on condition of anonymity because he was not authorized to discuss the event publicly.

The Pentagon briefed reporters late Sunday afternoon on the dramatic rescue.

"This was an incredible team effort, and I am extremely proud of the tireless efforts of all the men and women who made this rescue possible" Vice Adm. Bill Gortney, commander, U.S. Naval Forces Central Command, said in a statement.

He called Phillips and his crew "heroic."

The U.S. military official described a tense and terrifying few minutes for Phillips, during which "we definitely felt there was a life-threatening situation there."

He said the situation appeared "imminent" and that forces shot the pirates to death.

Following the rescue, Phillips was taken aboard the USS Bainbridge and later flown to the USS Boxer, where he called his family and got a medical evaluation.

FOX News' Anita Siegfriedt, Mike Levine and The Associated Press contributed to this report.