LONDON  A Guantánamo detainee at the center of a long standoff between the United States and Britain was freed and returned to Britain on Monday after almost seven years in American custody.

The detainee, Binyam Mohamed, was flown in a Gulfstream jet to the Northolt Royal Air Force Base in Northwest London, and by the evening had been released from detention.

Mr. Mohamed, 30, was captured in Pakistan in April 2002; American officials said that he was part of a conspiracy to detonate a dirty bomb on American soil. But all charges against him were eventually dismissed. He has said he was held for 18 months in Morocco, where he says he was tortured, then was moved to Afghanistan and then to Guantánamo Bay, Cuba.

The C.I.A. has repeatedly declined to say if Mr. Mohamed was held in Morocco, and has steadfastly denied that he, or anyone else in its custody, was ever tortured. Britain, where Mr. Mohamed established residence 15 years ago, had been seeking his release since August 2007.