American sailors
An undated picture released by Iran's Revolutionary Guards website shows American sailors sitting in an unknown place in IranReuters

Iranian naval authorities have released 10 US sailors who unwittingly strayed into the Islamic Republic's territorial waters in the Persian Gulf .

Officials in both the US and Iran have worked speedily to head off a serious international incident over the loss of the two patrol boats, which has been blamed on a navigational error. The US and its allies are on the cusp of lifting sanctions on Iran following an agreement on the country's nuclear programme in July.

Iran's Republican Guards broadcast a statement on Iranian state television saying it had freed the the US sailors and explaining they had been released into international waters.

Iranian naval authorities had promised the swift release of the sailors on state television, Admiral Ali Fadavi, the naval commander of Iran's Revolutionary Guards said the incident was "not hostile or for spying purposes", attributing it to a navigational error.

US Secretary of State John Kerry apologised to his counterpart Mohammad Javad Zarif for the mistake. The White House later said in a statement it had been assured of the sailors' safety.

Riverine patrol boat
United States Navy handout photo of a riverine patrol boat from Coastal Riverine SquadronReuters

Opponents of Iran's rapprochement with the west, particularly within the Republican dominated US Congress, had sought to undermine the nuclear deal following the detention of the US military personnel.

Iran's military top-brass have weighed in on the domestic squabble with Major General Hassan Firouzabadi, the head of Iran's military, saying the "incident in the Persian Gulf, which probably will not be the American forces' last mistake in the region, should be a lesson to troublemakers in the U.S. Congress", Reuters news agency reported.

The two small boats had been sailing between Kuwait and Bahrain when one vessel suffered a technical malfunction. The incident follows on from one in December (2015) when Iran fired rockets close to US vessels in the Strait of Hormuz.

In 2007 a British naval boat and its crew of 15 were captured by Iran while on patrol in the same area.