MANAMA, Bahrain (CNN) -- U.S. Navy snipers fatally shot three pirates holding an American cargo-ship captain hostage after seeing that one of the pirates "had an AK-47 leveled at the captain's back," a military official said Sunday.
Capt. Richard Phillips, right, stands with U.S. Navy Cmdr. Frank Castellano after Phillips' rescue Sunday.
The captain, who'd been held in a lifeboat in the Indian Ocean since Wednesday, was rescued uninjured, Navy Vice Adm. Bill Gortney told reporters.
Capt. Richard Phillips' ship, the Maersk Alabama, was stormed by pirates 300 miles off Somalia on Wednesday morning. He was "resting comfortably" on the USS Boxer after his rescue Sunday night, according to the Navy.
Phillips contacted his family and received a routine medical exam after his rescue at 7:19 p.m. (12:19 p.m. ET), the Navy Central Command said.
"The captain is in good health. He's showered up and in a clean set of clothes," Gortney said in a telephone news conference from Navy Central Command in Bahrain.
U.S. forces moved to rescue Phillips after seeing him in imminent danger on the lifeboat, Gortney said. A fourth pirate was negotiating Phillips' fate aboard the nearby USS Bainbridge.
"While working through the negotiations process tonight, the on-scene commander from the Bainbridge made the decision that the captain's life was in immediate danger, and the three pirates were killed," Gortney said. "The pirate who surrendered earlier today is being treated humanely; his counterparts who continued to fight paid with their lives."
The three pirates, who were armed with AK-47 rifles, were killed by shooters who were aboard the Bainbridge, Gortney said. Watch how U.S. forces believed Phillips was in danger »
The on-scene commander gave the shooters approval to open fire after seeing that "one of the pirates had an AK-47 leveled at the captain's back," Gortney said.
The fourth pirate was aboard the Bainbridge most of the day and told military negotiators that he wasn't going back to the other pirates, according to a defense official with knowledge of the situation.
Federal prosecutors would be "reviewing the evidence and other issues" to determine whether that pirate would be prosecuted in the United States, Justice Department spokesman Dean Boyd said.
It's the first time in modern history that the United States has in custody a pirate who carried out an attack on a U.S. citizen, said a senior U.S. official with knowledge of the situation. The source said figuring out what to do with the pirate is a sensitive issue.
Phillips' rescue came a day after he dove into the water in an attempt to escape his captors, Gortney said. The pirates "shot in the water at him" but eventually recaptured him without injuring him, Gortney said.
Maersk Line Limited President and CEO John Reinhart called Phillips "a leader of men ... [and] a brave and courageous man."
He said he has spoken with Phillips and said the captain is "feeling quite good."
Phillips and his family, through Reinhart, expressed gratitude to the U.S. Navy.
"I actually was more concerned for his family," said Adm. Rick Gurnon, head of the Massachusetts Maritime Academy, where Phillips had trained. "As a captain in sea, in a lifeboat, he was comfortable -- even if he was sharing it with Somali pirates." Watch Massachusetts Maritime Academy celebrate rescue »
Gurnon stressed that while Phillips was rescued, more than 200 mariners remain captives at sea.
"The pirates have a great business model that works for them: See ships, take ransom, make millions," he told reporters.
At the White House, President Obama issued a statement saying he is "very pleased that Capt. Phillips has been rescued and is safely on board the USS Boxer."
"His safety has been our principal concern, and I know this is a welcome relief to his family and his crew," Obama's statement said. "We remain resolved to halt the rise of piracy in this region. 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."
Obama had given standing orders for the military to take "decisive action" if Phillips was in "imminent danger," Gortney said.
Phillips offered himself as a hostage after the pirates stormed the U.S.-flagged Alabama Wednesday morning, according to Maersk. The pirates retreated to the lifeboat with Phillips, leaving the Alabama with its crew.
Phillips, of Underhill, Vermont, tried to escape by diving off the 28-foot, covered lifeboat Thursday night, but one of the pirates dove into the Indian Ocean to retrieve him.
Maersk Alabama crew members, who guided the ship to Kenya over the weekend, were "jubilant" when they received word of the rescue, a statement from the company said.
Alison McCall, a spokeswoman for Maersk, owner of the Alabama, read a statement from Phillips' family to reporters.
"The Phillips family wants to thank you all for your support and prayers. They have felt the caring and concern extended by the nation," McCall said. "This is truly a very happy Easter for the Phillips family." Watch spokeswoman read statement from Phillips' family »
On Saturday, the FBI launched a criminal investigation into Wednesday's hijacking of the U.S.-flagged cargo ship by Somali pirates, two law enforcement officials told CNN. The probe will be led by the FBI's New York field office, which is responsible for looking into cases involving U.S. citizens in the African region, the officials said.
Snippets of information started to emerge Saturday about how the Maersk Alabama's crew managed to retake the ship after it was hijacked by pirates Wednesday about 350 miles off the coast of Somalia in the Indian Ocean.
The Alabama reached port in Mombasa, Kenya, on Saturday. Crew members aboard the freed cargo ship described how some of their colleagues attempted to "jump" their pirate captors.
A scuffle ensued and one of the sailors stabbed a pirate in the hand in the battle to retake the container ship, one of the sailors told CNN.
Crew members smiled broadly as they stood on the ship's deck under the watchful eyes of security teams. Although the crew was kept away from the media, CNN's Stan Grant got close enough to ask crew members what happened after the pirates climbed aboard the ship.
One crew member said he recalled being awakened around 7 a.m. as the hijacking began. View a timeline of the attack and its aftermath »
"I was scared," Grant quoted the man as saying.
Some of the crew managed to hide in a secure part of the Alabama as the pirates stormed the ship, the sailor said.
As the sailors described their clash with the pirates, a crew member pointed to one shipmate and said, "This guy is a hero. He and the chief engineer, they took down the pirate. ... He led him down there to the engine room, and then they jumped him."
The shipmate added that he stabbed the pirate's hand and tied him up.
"Capt. Phillips is a hero," another crew member shouted from the deck of the freed ship.
Maersk CEO Reinhart told reporters Saturday that the crew will stay on board in Mombasa while the FBI conducts an investigation.
CNN's Zain Verjee, Barbara Starr, Kate Bolduan and Mike Mount contributed to this report.
All About Pirates • Mombasa • Somalia
O capitão Richard Phillips do navio cargueiro Maersk Alabama foi libertado dos piratas da Somalia depois de capturado por quatro dias. A Marinha dos Estados Unidos informou que três dos piratas foram mortos pelos Navy Seals por tiros e o quarto pirata foi preso.

Phillips foi movido para o navio de guerra USS Bainbridge, depois foi para o USS Boxer, onde foi examinado e estava com boa saúde.

A FBI lançou investigações sobre a captura do Maersk Alabama, que chegou em seu destino em Mombasa, Quênia, no sábado.