WASHINGTON — Shaker Aamer, whose detention at the Guantánamo Bay prison in Cuba attracted the attention of human rights lawyers, political leaders and rock stars, was freed on Friday after more than 13 years in captivity, British officials announced. Mr. Aamer, a Saudi citizen and British resident, was flown to London.

Mr. Aamer’s transfer, which was confirmed by the British foreign secretary, Philip Hammond, ends one of the best-known cases at the American prison.

At its center was a charismatic English-speaking detainee who has been the subject of intense dispute. Military officials have portrayed Mr. Aamer, 46, as a dangerous Islamist leader, while human rights advocates see him as a victim falsely accused of ties to terrorism. Now Mr. Aamer will be free to speak his mind in public.

In a statement issued through his lawyers after arriving at London Biggin Hill Airport, Mr. Aamer said he thanked everyone who worked for his release and wanted to “bring an end to Guantánamo.”