Ghezali then traveled to Medina in Saudi Arabia to study at the university. However, he was not accepted and returned to Sweden in March or April 2001 for a brief period before travelling to London where he studied at the madrasah of the Muslim cleric Omar Bakri. He then travelled to Pakistan in the summer of 2001 in order to study at one of the madrasahs situated there. After failing to gain acceptance into any of the madrasahs he then travelled to Afghanistan, where he according to his own statements stayed with a family in Jalalabad. Ghezali stated that:
"I lived a simple life, playing with the children and seeing how Afghans lived."
According to media reports Ghezali stayed at "Algerian House", supposedly a known hideout for al-Qaeda in Jalalabad. Information gleaned from interrogations with the captured terrorist Ahmed Ressam described "Algerian House" as a part of a training camp known as ”biot al-ansar”, or the house of sympathisers. At the first level sympathisers are given ideological indoctrination and basic weapons training before al-Qaeda leaders determine which sympathisers are to advance to the next level within the organization.
During his stay at Guantanamo Bay Ghezali was visited by representatives of the Swedish government (February 2002, January and July 2003 and January 2004) and was informed that he had been assigned an attorney in Sweden (Peter Althin) and that his case had been brought up in inter-governmental contacts and had been featured on several occasions in the Swedish media. Ghezali supposedly refused to discuss what he was doing in Afghanistan and Pakistan with the agents of the Swedish government.
On May 15, 2006 the United States Department of Defense released a list of all the individuals who had been held in military custody in their Guantanamo Bay detainment camps. That list gives Ghezali's Guantanamo detainee ID as 166. The DoD lists his place of birth as Stockholm.
Initially Swedish prosecutors stated that they would press charges against him for crimes committed prior to Ghezali's departure from Sweden, but they were subsequently dropped. There were also threats made against Ghezali, it was perceived that the Swedish government had given Ghezali too much help.
An article in the Boston Globe, on detainees who had returned to battlefield following their release, mentioned Ghezali. The article said Ghezali was being "monitored by Swedish intelligence agents". Ghezali has also stated in his book that he feels he is being intensely monitored by the Swedish Security Service (SÄPO), both in his home and when he moves around. He claims that the surveillance has caused him to feel depressed.
Ghezali has also made statements describing his stay at the Guantanamo Bay detainment camp. He claims to have been subject to torture such as sleep deprivation and made to sit in an interrogation room for thirteen hours in a row. He is planning a class-action lawsuit against the USA. He has together with Gösta Hultén published a book, Fånge på Guantánamo : Mehdi Ghezali berättar (Prisoner on Guantanamo: Mehdi Ghezalis tells) ISBN 91-7343-086-2, in which he chronicles his experiences.
Jag känner honom inte som person och därför kan jag inte döma honom. Jag tror inte på det amerikanerna säger om honom. Det är mycket som inte stämmer. (I do not know him as a person and therefore cannot pass judgment over him. I do not believe that which the Americans say about him. There is a lot that does not add up.)Ghezali's refusal to reveal what he was doing in Afghanistan and Pakistan has been highlighted in Swedish media and was brought up in the context of his stay at the Guantanamo Bay detainment camp.
Ghezali was also suspected of having participated in a prison uprising in Pakistan, where 17 people (including seven prison guards) were killed. Ghezali and 47 other prisoners were being transported in a bus when the guards were overpowered and the prisoners fled into the wilderness. The majority of the prisoners were captured again, and were facing execution for their participation in the uprising. After an intervention from the United States the threat of execution was withdrawn and Ghezali was taken into U.S. custody. When questioned about the prison uprising at the press conference following his release Ghezali denied any having any knowledge of or participation in the prison uprising.
Ghezali is reported to have dropped his suit against the US government. According to The Muslim News: