After hours of tension and a looming diplomatic crisis, the Islamic Republic released the 10 US crewmen who were captured after having drifted into its territorial waters.

Iran released on Wednesday the 10 US sailors it had detained after they drifted with their boats into Iranian territorial waters in the Persian Gulf.

The Islamic Revolution Guards Corps (IRGC) issued a statement on the release and said that its investigations showed that the sailors had gone astray and that their sail into Iranian waters was not a purposeful act.

“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 statement said.

“The Americans have undertaken not to repeat such mistakes,” it added, and continued, “The captured marines were released in international waters under the supervision of the IRGC Navy moments ago.”

The IRGC seized two US Navy boats with a crew of nine men and one woman on Tuesday and detained them on Iran’s Farsi Island in the Persian Gulf.

Iranian media reports that following the arrest, two US and French aircraft carriers as well as their accompanying fleets started maneuvering near Iranian waters.

The IRGC statement blamed the US flotilla for its “excited and unprofessional moves”, but said the “IRGC navy could handle the situation and restored calm in the region through powerful and wise moves.”

Senior US officials, including Secretary of State John Kerry, were in contact with their Iranian counterparts on the fate of the marines since Tuesday, and according to Iranian officials, Foreign Minister Mohammad Javad Zarif had told Kerry that the US should extend a formal apology first.

According to the statement, the Americans have done so.

The US Navy’s Bahrain-based 5th Fleet had no immediate comment or confirmation of the release.