DUBAI, UNITED ARAB EMIRATES — It turned out to be the international crisis that wasn't.

Less than a day after 10 U.S. Navy sailors were detained in Iran when their boats drifted into Iranian waters, they and their vessels were back safely Wednesday with the American fleet.

U.S. Secretary of State John Kerry tapped the personal relationship he has formed with Iranian Foreign Minister Mohammed Javad Zarif in the three years of negotiations over Iran's nuclear program, speaking with him at least five times by telephone. Kerry credited the quick resolution to the "critical role diplomacy plays in keeping our country secure and strong."

U.S. Defense Secretary Ash Carter thanked Kerry after the sailors' release and couched the incident in humanitarian terms, noting that "the U.S. Navy routinely provides assistance to foreign sailors in distress."

For Tehran, the Americans' swift release was a way to neutralize a potential new flashpoint days before it was expected to meet the terms of last summer's nuclear deal, which will give Iran significant relief from painful economic sanctions.

It is likely that Supreme Leader Ayatollah Ali Khamenei, who has the final say on all matters of state, would have had to approve the release, given the immense political sensitivities.


But the rapid resolution also was a victory for moderate President Hassan Rouhani, who has promoted greater openness with the outside world despite strident opposition from deeply entrenched hard-liners at home.

"Rouhani's policy of interaction is working," said Iranian political analyst Saeed Leilaz. "Iran and the U.S. have gone a long way in reducing tensions but still have a long way to go in improving their contacts. It was a big step forward."

The nine men and one woman were detained Tuesday after at least one of their boats suffered mechanical problems off of Farsi Island, an outpost in the middle of the Persian Gulf that has been used as a base for Revolutionary Guard speedboats since the 1980s.

The Americans' small Riverine boats were sailing between Kuwait and Bahrain on a training mission when the U.S. lost contact.

The sailors left the island at 0843 GMT (3:43 a.m. EST) Wednesday aboard their boats, the Navy said. They were picked up by Navy aircraft, and other sailors took control of the vessels for the return voyage to Bahrain, where the U.S. 5th Fleet is based.

Cmdr. Kevin Stephens, a 5th Fleet spokesman, said the priority now would be determining "how exactly these sailors found themselves in Iran."

He declined to say where they were going or give details on their identities, but a senior defense official said they were heading to a U.S. military facility in Qatar. The official, who was not authorized to discuss the matter publicly, said they are being debriefed and getting medical exams but were not harmed.

In Washington, a defense official said the Navy has ruled out engine or propulsion failure as the reason the boats entered Iranian waters. Navigation problems, due either to human or mechanical failure, could not be ruled out, said the official, who was not authorized to discuss details of the incident and so spoke on condition of anonymity.

The sailors were part of Riverine Squadron 1, based in San Diego, U.S. officials said. When the U.S. lost contact with the boats, ships attached to the USS Harry S Truman aircraft carrier strike group began a search, as did aircraft from the Truman. The officials also spoke on condition of anonymity because they were not authorized to discuss the incident publicly.

The Revolutionary Guard released images of the U.S. sailors before their release, showing them sitting on the floor of a room. They looked mostly bored or annoyed, although one appeared to be smiling. The woman had her hair covered by a brown cloth. The pictures also showed what appeared to be their two boats.

State TV later released more video and photos of the Americans apparently surrendering on their knees, their hands behind their head. It also showed machine guns and ammunition they had onboard.

"After determining that their entry into Iran's territorial waters was not intentional, and their apology, the detained American sailors were released in international waters," the Guard said.

Vice President Joe Biden, speaking later to "CBS This Morning," denied the U.S. made an apology.

"There's nothing to apologize for," Biden said. "When you have a problem with the boat, you apologize the boat had a problem? No, and there was no looking for any apology. This was just standard nautical practice."

Iranian TV ran video of one of the sailors apologizing for the intrusion into Iranian waters.

"It was a mistake. That was our fault and we apologize for our mistake," the unidentified sailor is shown saying in English.

The U.S. Central Command later said: "The video appears to be authentic, but we cannot speak to the conditions of the situation or what the crew was experiencing at the time." It added that the crew was undergoing "the reintegration process and we will continue to investigate this incident."

"What matters most right now, however, is that our sailors are back safely," it added.

In his statement, Kerry expressed his "gratitude to Iranian authorities for their cooperation ?in swiftly resolving this matter."

Gen. Ali Fadavi, the Guard's navy chief, accused the Americans of "unprofessional acts" for 40 minutes before the sailors were picked up by Iranian forces.

The quick resolution stood in contrast to the 2007 seizure by Iran of 15 British sailors and marines who were searching for a merchant ship in the Gulf. Iran held them for 13 days, with the captives saying they were kept in cold, stone cells, blindfolded and fearing execution, and coerced into falsely saying they had entered Iranian waters.

Their detention by the Revolutionary Guard occurred under hard-line President Mahmoud Ahmadinejad. A day after they were seized, the U.N. Security Council imposed more sanctions on Iran for refusing to halt uranium enrichment.

Haleh Esfandiari, the Iranian-American director of the Middle East program at the Woodrow Wilson International Center for Scholars, called the Americans' release "a big victory for Rouhani and his team."

"Finally, he was able to assert himself vis a vis the Revolutionary Guard. ... He is trying to change Iran's 'in-your-face image' that developed under Ahmadinejad," Esfandiari said.

"They must have contacted the Supreme Leader and said ... 'If we let this become an international incident, there is no way we can restore that sense of goodwill that we are trying to project,'" she added.

The Guard's 200,000-member force is different from the regular Iranian military and is charged with protecting the ruling system. Its naval forces are heavily dependent on armed speedboats that can be used in teams to swarm much larger vessels.

Tuesday's incident recalled the 2009 arrest of three American hikers by Iran as they traveled along the country's border with Iraq. One hiker, Sarah Shourd, was released after more than 13 months in custody after mediation by Oman. Her travel companions, Josh Fattal and Shane Bauer, were convicted of espionage but set free a year after her.

The sailors' detention came just hours before President Barack Obama gave his final State of the Union address and amid a period of renewed maritime tensions with Iran. Last month, Iran conducted a rocket test near U.S. warships and boats passing through the narrow Strait of Hormuz, the route for about a fifth of the world's oil.

Iran sank a replica of a U.S. aircraft carrier near the strait in February 2015 and has said it is testing "suicide drones" that could attack ships. It also has challenged foreign cargo ships in the Gulf, opening fire on at least two last year. In one incident, Iran temporarily seized a Marshall Islands-flagged cargo ship over what it said was a commercial dispute before releasing it and its crew more than a week later.

Iran is expected to satisfy the terms of the nuclear deal in just days. Once the U.N. nuclear agency confirms Iran's actions to roll back its program, the U.S. and other Western powers are obliged to suspend wide-ranging oil, trade and financial sanctions on Tehran. Kerry recently said the deal's implementation was "days away."

Four Americans of Iranian origin remain held by Iran, including journalist Jason Rezaian of The Washington Post; former U.S. Marine Amir Hekmati of Flint, Michigan; pastor Saeed Abedini of Boise, Idaho; and Siamak Namazi, a businessman and the son of a politician from the shah's era. Separately, former FBI agent Robert Levinson disappeared in Iran in 2007 while working for the CIA on an unapproved intelligence mission.

Dareini reported from Tehran, Iran. Associated Press writers Matthew Lee, Lolita C. Baldor, Bradley Klapper, Robert Burns and Richard Lardner in Washington, Nasser Karimi and Amir Vahdat in Tehran, and Jon Gambrell in Dubai contributed to this report.