US Secretary of State John Kerry has thanked Iran for freeing 10 US Navy sailors who had entered Iranian territorial waters inadvertently.

"I want to express my gratitude to Iranian authorities for their cooperation ‎in swiftly resolving this matter," Kerry said in a statement on Wednesday, according to Reuters.

"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 added.

Earlier in the day, Iran's Islamic Revolutionary Guards Corps (IRGC) said it had freed the US Marines after holding them overnight.

The sailors had been arrested aboard two US Navy patrol boats in the Persian Gulf on Tuesday.

The Public Relations Office of the IRGC announced the release after determining the sailors had entered Iranian territorial waters by mistake.

“Following the illegal and unpermitted entry of two American Navy vessels into the Islamic Republic of Iran’s territorial waters near Farsi Island in the Persian Gulf on the evening of the previous day, the vessels stopped, obeying a warning by IRGC vessels, and their crewmembers, who comprised nine male Marines and one female Marine, were placed under arrest,” the statement IRGC read.

“After technical and operational examinations done in interaction with the country’s relevant political and national security authorities and the establishment of the inadvertent and unintentional nature of the entry by the American Navy crafts and their apology, a decision was made to free them,” it added.

This photo shows US Marines whose boats were seized by the IRGC forces in the Persian Gulf after trespassing on Iran's territorial waters. (Photo by Tasnim)

The statement said the Americans had pledged not to repeat the mistake, adding, “...the arrested American Marines were released into international waters under IRGC Navy vessels’ watch.”

Biden: No apology over incident

US Vice President Biden, however, on Wednesday claimed that Iran neither sought nor the United States had issued an apology to Tehran in order to secure the sailors' freedom.

Biden’s statement contradicts previous media reports that stated the US apologized for the incident.

“No, there was no apology, there was [nothing] to apologize for,” Biden said told CBS News. “When you have a problem with a boat, do you apologize the boat had a problem? No, and there was no looking for any apology. This was just standard nautical practice.”