The men arrived on shore in Dubai on Wednesday, flashing smiles, waving at the cameras and looking relaxed.
The 60-foot yacht was in the Persian Gulf on its way from Bahrain to Dubai last Wednesday for the start of its first offshore race when it ran into a problem with its propeller, said Andrew Pindar, whose Team Pindar owns the yacht. It drifted into Iranian waters and was seized by the elite Revolutionary Guard's navy.
"After carrying out an investigation and interrogation of the five British sailors, it became clear that their illegal entry was a mistake," the Revolutionary Guard said in a statement carried by the official IRNA news agency. "After obtaining necessary guarantees, it was decided to release them."
The British government had tried to keep the case from being politicized at a time when Tehran is under heavy pressure from the West over its nuclear program. Iran has accused Britain and other foreign governments of stoking the country's postelection street protests.
The tensions with the West have also been heightened by Iran's detention of three Americans arrested this summer after they strayed across the border from northern Iraq. Washington and their families say the three unintentionally crossed into Iran while hiking, but Tehran.
Charles Porter, father of sailor Luke Porter, said his son reported being blindfolded by Iranian authorities at first.
"The first day, two days, the Iranian authorities were very suspicious, therefore they were treated with suspicion," Porter said Wednesday after the men's families had a meeting with the Foreign Office in London. "As soon as they understood there was no great threat … they were treated extremely well."
Edwin Smith, father of sailor Oliver Smith, said the families were relieved and delighted.
"We've all been holding our breath and crossing our fingers for the last seven days, not knowing if it was going to last a week, three weeks, three months or however long," he said. "My son said to us on the phone it was a little bit tense on the first day, and then all the guys were cool, everybody was happy."
One of the freed yachtsmen, David Bloomer, told BBC that their straying was a "completely innocent mistake" and the area they strayed into was not marked as restricted.
"We were stopped by the guys in the patrol boat and they wanted to know who we were and what we were. We told them. They weren't happy with that. They said you must turn round and come with us," he said.
Bloomer added: "Our treatment was very good. They very quickly realized that we were not having any ill intent, that we are innocent of any wrong doing."
The five Britons arrived in Dubai on Wednesday night.
British Foreign Secretary David Miliband said the matter was handled "in a straightforward, professional way by the Iranian authorities."
It was not clear where the Britons were held during their week in custody.
Team Pindar is an independent British-based yachting team. It runs the yacht called Kingdom of Bahrain under the Sail Bahrain initiative in partnership with the tiny Gulf island kingdom of Bahrain.
Iran warned Tuesday the sailors would be prosecuted if it was proven they had "bad intentions" when they entered Iranian waters.
The yacht had been heading to join the 360-mile (580-kilometre) Dubai-Muscat Offshore Sailing Race, which was to begin Nov. 26. The race went ahead without the yacht.
British media had identified the five Britons as Oliver Smith, of Southampton; Sam Usher, of Scarborough; Luke Porter, of Weston-super-Mare; Oliver Young, of Saltash; and David Bloomer, who is from Malahide, Ireland but holds a British passport.
In 2007, Iran seized 15 British military personnel in the Gulf, claiming they had entered Iranian waters, though Britain insisted they were in Iraqi waters. Eventually all were freed without an apology from Britain.