Britain's Foreign Office confirmed Wednesday that five British sailors detained by Iran after their racing yacht strayed into Iranian waters last week have been released.

Iran's official IRNA news agency reported that the sailors were released early Wednesday after an interrogation by authorities found their entry into Iranian waters had been a mistake.

"I welcome the fact this has been dealt with in a straightforward, professional way by the Iranian authorities," said U.K. Foreign Secretary David Miliband.

"Obviously, this has been a real ordeal for the young men and their families and I'm really delighted that it's over for them and that we can call the matter closed," he said.

The sailors were detained on Nov. 25 off the coast of Iran. They had been on their way to the 580-kilometre Dubai-Muscat Offshore Sailing Race, which was to begin Nov. 26.

The 18-metre yacht, named Kingdom of Bahrain, experienced propeller problems, causing it to drift into Iranian waters, said Andrew Pindar of Team Pindar, an independent British-based racing team, which owns the yacht. The boat was seized by the Revolutionary Guard near the Iranian island of Sirri, which is near the mouth of the narrow Hormuz Strait off Dubai.

A U.K. foreign office spokesman said in a brief statement that the yachtsmen are being towed to international waters. A spokeswoman for Sail Bahrain said the sailors were to be met by a representative of the company, who was to tow them to Dubai.

"We are all absolutely thrilled with the news," said Pindar. "It has been an extremely worrying time for all of us and particularly for the families and loved ones of those on board."

On Tuesday, Iran threatened that the yachtsmen would be prosecuted if it were proven they had "bad intentions" when their yacht entered its territorial waters.

With files from The Associated Press