The men arrived on shore in Dubai flashing smiles, waving at the cameras and looking relaxed.
"We had no intention of upsetting anyone," sailor Oliver Smith told a news conference. "We were just trying to get here (to Dubai) to start the yacht race. The guys on the ground there treated us very well," he added.
He said the five were kept together in a padlocked room, but their guards let them outside in the evenings.
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 recently accused them of espionage.
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."
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-kilometer) 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.
Associated Press Writer Jennifer Quinn in London contributed to this report.