Wednesday morning, Iran released 10 American sailors unharmed whose riverine boats drifted near Iranian waters, ending nearly 16 hours of tense negotiations.

The release was announced by Iran and by the U.S. 5th Fleet, based in Bahrain. The sailors departed Farsi Island at 11:45 a.m. local time aboard the Riverine Command Boats they were captured in. They were later picked up by a military aircraft, according to the release, and other sailors took the RCBs to Bahrain, the original destination.

"The Navy will investigate the circumstances that led to the sailors presence in Iran," the release said.

Iran had accused the sailors of "snooping" on their activities at Iran's Farsi Island in the Arabian Gulf, which is a base of Iran's elite paramilitary force where the 10 sailors were held overnight.

Iran's semiofficial news agency says the sailors were detained Tuesday after straying into Iranian waters in the Arabian Gulf.

The sailors were held overnight on Farsi Island, a base for the elite Revolutionary Guard Corps. The IRGC said Wednesday that "it has released the US marines and their vessels in international waters," as quoted by the semi-official Fars news agency.

"Following technical and operational investigations and in interaction with relevant political and national security bodies of the country and after it became clear that the US combat vessels' illegal entry into the Islamic Republic of Iran's waters was the result of an unpurposeful action and a mistake and after they extended an apology, the decision was made to release them," the IRGC statement continued.

The Iranians reportedly seized the GPS equipment on the riverine command boats, a 49-foot-long jet-propelled attack craft that can speed up to 43 knots and that boasts sensitive communications gear for use as a command vessel.

A video released Wednesday by the Fars news agency appears to show the 10 sailors surrendering, as they knelt on the deck of the riverine boats, hands on their heads. The riverine command boats were docked at a pier on Farsi Island, where Iranian officials scoured the high-tech vessels for secrets. They found a binder of riverine forces checklists and took shots of the crew cockpit.

The sailors appear to have been detained in a white-walled room, where they rested on the carpet with pillows as they awaited their release.

Overnight, the BBC reported that Iran demanded an apology from the U.S. for invading its territorial waters and that the U.S. obliged. But a spokesman for the U.S. State Department pushed back, saying there was no truth to the rumor that Secretary of State John Kerry apologized to Iran.