Tehran released 10 US Navy sailors who were arrested Tuesday after their boats entered Iranian territorial waters.

The US Navy said the American crewmembers were returned safely and there were no indications they had been harmed while in custody.

The nine men and one woman had been held at an Iranian base on Farsi Island in the Persian Gulf after being detained nearby on Tuesday. The tiny outpost has been used as a base for Revolutionary Guard speedboats as far back as the 1980s.

The sailors departed the island at 8:43 a.m. GMT aboard the boats they were detained with, the Navy said. They were picked up by Navy aircraft and other sailors took control of their boats for the return to Bahrain, where the US 5th Fleet is based.

US sailors released by Iran on January 13, 2016, after their ships entered Iranian territorial waters the day before. (screen capture/Twitter)

US sailors released by Iran on January 13, 2016, after their ships entered Iranian territorial waters the day before. (screen capture/Twitter)

“The Navy will investigate the circumstances that led to the sailors’ presence in Iran,” the US statement said.

Earlier Wednesday, an Iranian admiral said the standoff “is being resolved,” after officials concluded that the boats entered Iran’s waters accidentally.

“Investigation shows that entry of American sailors into Iran’s territorial waters was due to mechanical problems in their navigation system,” Gen. Ali Fadavi, Navy chief in Iran’s powerful Revolutionary Guards (IRGC), was quoted as saying on Iran’s state TV.

US officials had said on Tuesday that Tehran assured them the crew and vessels would be returned safely and promptly.

The Revolutionary Guards said the US had “apologized” for the incident, and promised it would not recur, Iranian state-affiliated media said Wednesday. “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,” an IRGC statement said.

US Defense Secretary Ash Carter welcomed the release of the 10 sailors. In a statement Wednesday, Carter said he wanted to thank Secretary of State John Kerry for his “diplomatic engagement” on the issue. Kerry has a close relationship with Iranian Foreign Minister Mohammed Javad Zarif after the recent nuclear deal between the Islamic Republic and world powers. Carter also said: “Around the world, the U.S. Navy routinely provides assistance to foreign sailors in distress, and we appreciate the timely way in which this situation was resolved.”

Kerry thanked Iran in a statement on Wednesday: “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,” he said.

Vice President Joe Biden said America did not apologize to Iran. In an interview with “CBS This Morning,” Biden said: “There’s nothing to apologize for. 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.” Biden said that the Iranians realized the US sailors “were there in distress and said they would release them and released them like ordinary nations would do.”

Earlier Wednesday, Fadavi said the American boats had shown “unprofessional acts” for 40 minutes before being picked up by Iranian forces after entering the country’s territorial waters.

“US naval force and their frigate showed an unprofessional behavior and had air and naval moves for 40 minutes in the area,” Fadavi said at one point. He said Tehran did not consider the US Navy boats violating Iranian territorial waters as “innocent passage.

“Certainly US presence in Persian Gulf and their passage has never been innocent and we do not deem their passage as innocent,” he added.

Ali Fadavi, IRGC Navy commander. (YouTube screenshot)

Ali Fadavi, IRGC Navy commander. (YouTube screenshot)

Fadavi said Iranian Foreign Minister Mohammad Javad Zarif “had a firm stance” during a telephone conversation with US Secretary of State John Kerry “on their presence in our territorial waters and said they should not have come and should apologize.

“This process is underway now and will not last long. The Guards naval force will carry out orders of top commanders regarding this case as soon as we receive them,” he said.

Gen. Ramezan Sharif, spokesman for the Guards, said the US military personnel were to be debriefed.

“If it is determined, after the investigation is carried out, that their action was not intentional, another approach will be taken,” he said. “But If it’s determined, after they are debriefed and interviewed, that their entry (into Iran’s territorial waters) was for intelligence gathering or irrelevant action, definitely the authorities will take the necessary measures.”

In this Oct. 30, 2015, photo provided by the US Navy, Riverine Command Boat (RCB) 805, along with its crew members, is shown transiting through rough seas during patrol operations in the Persian Gulf. (Torrey W. Lee/US Navy via AP)

In this Oct. 30, 2015, photo provided by the US Navy, Riverine Command Boat (RCB) 805, along with its crew members, is shown transiting through rough seas during patrol operations in the Persian Gulf. (Torrey W. Lee/US Navy via AP)

US officials said the sailors were part of Riverine Squadron 1 based in San Diego and were deployed to the US Navy’s 5th Fleet in Bahrain. When the US lost contact with the boats, ships attached to the USS Harry S Truman aircraft carrier strike group began searching the area, along with aircraft flying off the Truman.

The Riverine boats were not part of the carrier strike group, and were on a training mission as they traveled between Kuwait and Bahrain, officials said. The craft are not considered high-tech and don’t contain any sensitive equipment, so there were no concerns about the Iranians gaining access to them, they added.

The incident came on the heels of an incident in late December when Iran launched 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 last February and has said it is testing “suicide drones” that could conduct kamikaze missions on naval ships. It has also challenged foreign cargo ships operating in the Gulf, opening fire on at least two in April and May.

In one of those incidents, Iran temporarily seized a Marshall Islands-flagged cargo ship over what it said was a commercial dispute before releasing it with its crew more than a week later.

This picture released by the Iranian Revolutionary Guards on Wednesday, Jan. 13, 2016, shows American Navy boats in custody of the guards (Sepahnews via AP)

This picture released by the Iranian Revolutionary Guards on Wednesday, Jan. 13, 2016, shows American Navy boats in custody of the guards (Sepahnews via AP)