Navy Seal snipers on the fantail of a destroyer killed three Somali pirates in a lifeboat and rescued an American sea captain on Easter Sunday. The surprise nighttime assault in choppy seas ended a five-day standoff between a team of rogue gunmen and the US military. It was a stunning conclusion to an Indian Ocean odyssey that began when 53-year-old freighter Capt. Richard Phillips was taken hostage Wednesday by pirates who tried to hijack the US-flagged Maersk Alabama. The Vermont native was held on a tiny lifeboat that began drifting precariously toward Somalia's anarchic, gun-plagued shores. The operation, personally approved by President Barack Obama, quashed fears the saga could drag on for months and marked a victory for the US, which for days seemed powerless to resolve the crisis despite massing helicopter-equipped warships at the scene. Negotiations with the three pirates were growing heated, Vice Adm. Bill Gortney said. One of them pointed an AK-47 at the back of Phillips, who was tied up and in "imminent danger" of being killed when the commander of the nearby USS Bainbridge made the split-second decision to order his men to shoot, Gortney said. Navy snipers took aim at the pirates' heads and shoulders, he said. The lifeboat was about 25-30 yards away and was being towed by the Bainbridge at the time, he said. The pirates had agreed to the tow to move the powerless lifeboat out of rough water. A fourth pirate surrendered after boarding the Bainbridge earlier in the day and could face life in a US prison. He had been seeking medical attention for a wound to his hand and was negotiating with US officials on conditions for Phillips' release, military officials said. The rescue was a dramatic blow to the pirates who have preyed on international shipping and hold more than a dozen ships with about 230 foreign sailors. But it is unlikely to do much to quell the region's growing pirate threat, which has transformed one of the world's busiest shipping lanes into one of its most dangerous. It also risked provoking retaliatory attacks. "This could escalate violence in this part of the world, no question about it," said Gortney, the commander of US Naval Forces Central Command. Abdullahi Lami, one of the pirates holding the Greek ship anchored in the Somali town of Gaan, said: "Every country will be treated the way it treats us. In the future, America will be the one mourning and crying," he told The Associated Press. "We will retaliate (for) the killings of our men." Jamac Habeb, a 30-year-old self-proclaimed pirate, told the AP from one of Somalia's piracy hubs, Eyl, that: "From now on, if we capture foreign ships and their respective countries try to attack us, we will kill them (the hostages)." "Now they became our number one enemy," Habeb said of US forces. Phillips was not hurt in several minutes of gunfire and the US Navy's 5th Fleet said he was resting comfortably on a US warship after receiving a medical exam. Aboard the Bainbridge, sailors passed along a message from Andrea Phillips to her husband: "Richard, your family loves you, your family is praying for you, and your family is saving a chocolate Easter egg for you, unless your son eats it first." Phillips himself deflected any praise. "I'm just the byline. The real heroes are the Navy, the Seals, those who have brought me home," Phillips said by phone to Maersk Line Limited President and CEO John Reinhart, the company head told reporters. A photo released by the Navy showed Phillips unharmed and shaking hands with the commanding officer of the USS Bainbridge. Obama said Phillips had courage that was "a model for all Americans" and he was pleased about the rescue, adding that the United States needs help from other countries to deal with the threat of piracy and to hold pirates accountable. With news of the rescue, Phillips' 17,000-ton ship, which docked with the 19 members of his crew Saturday in Mombasa, Kenya, erupted into wild cheers. Some waved an American flag and one fired a bright red flare skyward in celebration. "We made it!" said crewman ATM Reza, pumping his fist in the air. The ship had been carrying food aid bound for Rwanda, Somalia and Uganda when the ordeal began hundreds of miles (kilometers) off Somalia's eastern coast Wednesday. Crew members said they saw pirates scrambling into the ship with ropes and hooks from a small boat bobbing on the surface of the Indian Ocean far below. As the pirates shot in the air, Phillips told his crew to lock themselves in a cabin and surrendered himself to safeguard his men, crew members said. Phillips was then taken hostage in an enclosed lifeboat that was soon shadowed by three US warships and a helicopter in a standoff that grew by the day. The pirates were believed armed with pistols and AK-47 assault rifles. Talks to free him began Thursday with the captain of the USS Bainbridge talking to the pirates under instruction from FBI hostage negotiators on board the US destroyer. The pirates had threatened to kill Phillips if attacked. A government official and others in Somalia with knowledge of the situation said negotiations broke down late Saturday. The stumbling block, Somali officials said: Americans' insistence the pirates be arrested and brought to justice. Phillips jumped out of the lifeboat Friday and tried to swim for his freedom but was recaptured when a pirate fired an automatic weapon into the water, according to US Defense Department officials speaking on condition of anonymity because they are not authorized to talk about the unfolding operations. On Saturday, pirates fired a few shots at a small US Navy vessel that had approached, but the US sailors did not return fire. The US Navy had assumed the pirates would try to get their hostage to shore, where they could have hidden him on Somalia's lawless soil and been in a stronger position to negotiate a ransom. Somalia's government, which barely controls any territory in the country, welcomed the news of Phillips' rescue. "The Somali government wanted the drama to end in a peaceful way, but any one who is involved in this latest case had the choice to use violence or other means," Abdulkhadir Walayo, the prime minister's spokesman, told the AP. "We see it will be a good lesson for the pirates or any one else involved in this dirty business." Worried residents of Harardhere, another port and pirate stronghold, were gathering in the streets after news of the captain's release. "We fear more that any revenge taken by the pirates against foreign nationals could bring more attacks from the foreign navies, perhaps on our villages," Abdullahi Haji Jama, who owns a clothes store in Harardhere, told the AP by telephone. Pirates are holding about a dozen ships with more than 200 crew members, according to the Malaysia-based piracy watchdog International Maritime Bureau. Hostages are from Bulgaria, China, Germany, Indonesia, Italy, the Philippines, Russia, Taiwan, Tuvalu and Ukraine, among other countries. The Navy said Phillips was freed at 7:19 p.m. local time. He was taken aboard the USS Bainbridge and then flown to the USS Boxer for the medical exam, 5th Fleet spokesman Lt. Nathan Christensen said. Christensen said Phillips was now "resting comfortably." The USS Boxer was in the Indian Ocean off the coast of Somalia, Christensen said. US officials said a fourth pirate had surrendered and was in military custody. FBI spokesman John Miller said that would change as the situation became "more of a criminal issue than a military issue." A spokeswoman for the Phillips family, Alison McColl, said Phillips and his wife, Andrea, spoke by phone shortly after he was freed. "I think you can all imagine their joy and what a happy moment that was for them," McColl said outside of the Phillips home in Underhill, Vermont. "They're all just so happy and relieved. Andrea wanted me to tell the nation that all of your prayers and good wishes have paid off, because Capt. Phillips is safe." Capt. Joseph Murphy, the father of second-in-command Shane Murphy, thanked Phillips for his bravery. "Our prayers have been answered on this Easter Sunday," Murphy said. "If not for his incredible personal sacrifice, this kidnapping and act of terror could have turned out much worse." Murphy said both his family and Phillips' "can now celebrate a joyous Easter together." "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" Gortney said in a statement. He called Phillips and his crew "heroic." Terry Aiken, 66, who lives across the street from the Phillips house, fought back tears as he reacted to the news. "I'm very, very happy," Aiken said. "I can't be happier for him and his family."