The 10 American sailors captured by Iran have been freed, U.S. and Iranian officials said.
A Navy statement said the detained sailor have been transferred to shore and are no longer on USS Anzio, the ship on which they departed from Iran.
The sailors were captured Tuesday after their two naval boats entered Iranian waters near Farsi Island, in the Persian Gulf.
The wait for the sailors' release Wednesday morning dragged on for hours, with Iranian officials interrogating the sailors about their motives and demanding a U.S. apology.
But an Iranian Revolutionary Guard Corps spokesman told state-run media the boats strayed into Iranian waters by accident.
"The evidence suggests that they unintentionally entered the Iranian waters because of the failure of their navigational system," IRGC spokesman Ramazan Sharif said.
On Wednesday afternoon, the sailors traveled on their two boats to a rendezvous point in the Persian Gulf, a U.S. official said. They were escorted by Iranian boats, which turned back when they reached the rendezvous point in international waters.
The sailors then boarded the guided missile cruiser USS Anzio, where they underwent medical checks Wednesday.
"There are no indications that the Sailors were harmed during their brief detention," the U.S. Navy said in a statement.
The Navy said it would investigate how the sailors ended up in Iranian territory.
Secretary of State John Kerry expressed "gratitude to Iranian authorities for their cooperation in swiftly resolving this matter," in a statement Wednesday.
"As a former Sailor myself, I know the importance of naval presence around the world and the critical work being done by our Navy in the Gulf region," he said, adding later, "That this issue was resolved peacefully and efficiently is a testament to the critical role diplomacy plays in keeping our country safe, secure, and strong."
Calls for an apology
On Wednesday morning, officials interrogated the sailors to see whether they "entered Iranian waters intentionally on an intelligence mission," the IRGC said, according to state-run Press TV.
Iran's foreign minister called for the United States to apologize for the "encroachment" of American vessels into Iranian territorial waters, an Iranian navy official told state-run media.
IRGC Navy commander Adm. Ali Fadavi said the presence of the U.S. Navy in the Persian Gulf waters "disturbed the security of the area" and criticized the U.S. Navy maneuvers.
What the ships were doing
The vessels were en route from Kuwait to Bahrain and were sailing near Farsi Island in the Persian Gulf.
A senior defense official told CNN the boats were in the area of Farsi Island for refueling, but it's not clear whether they actually refueled -- raising the possibility they ran out of fuel.
Another senior defense official said no distress call came from the boats.
Iran's official IRNA news agency reported that the boats were "rescued" by Iranian navy sailors.
There is nothing to indicate the capture was a hostile act on the part of Iran, a senior Obama administration official said.
Timing with the nuclear deal
The capture of the sailors came days before the nuclear deal between Iran and world powers is expected to go into force. The deal freezes Iran's nuclear program in exchange for lifting sanctions against Iran.
And that might be why the U.S. sailors were held for only one day, a CNN military analyst said.
"I certainly think they were released quickly because of the ongoing Iran deal," retired Lt. Gen. Mark Hertling said.
Otherwise, "they probably would have been kept a few more days," Hertling said.
He noted that when British sailors were captured by Iran in 2007, they were held for about two weeks.
"I think there potentially is a new age coming about with Iran," Hertling said. "This is going to improve military-military relationships."
In 2004, three British patrol boats were boarded and seized by Iranian security forces in the Shatt al Arab waterway, which divides Iraq and Iran. The crews of the three boats, including eight British sailors and marines, were blindfolded and paraded on Iranian state TV and held captive for three days.
In 2007, Iran captured 15 British sailors and marines in the Persian Gulf and accused them of trespassing in Iranian territorial waters. Britain maintained that its service members never entered Iranian waters.
Those British service members were paraded before then-President Mahmoud Ahmadinejad, and critics said their apologies were extracted under duress. They were released after two weeks.
After the 2007 capture, Adm. Mike Mullen, who was U.S. chief of naval operations at the time, said, "We've got procedures in place which are very much designed to carry out the mission and protect the sailors who are there, and I would not expect any sailors to be able to be seized by the Iranian navy or the Iranian Republican Guard."