The lawyer for a former Guantanamo Bay prisoner turned peace activist who was detained on arrival in Canada as an apparent national security threat will likely be allowed to return to France.

Hadayt Nazami said Wednesday that Mourad Benchellali, of Lyon, was being held as a maximum security prisoner after agents refused to allow him to withdraw his request to enter Canada and go home voluntarily.

Nazami says they changed their mind and are going to let him go. Benchellali, 34, was expected to leave Canada as early as Wednesday night.

The French citizen, known for his work on deradicalization, was detained at Toronto's international airport late Tuesday after arriving for a speaking tour. Immigration authorities indicated he was deemed to be a security risk.

A spokeswoman with Canada Border Services Agency refused to comment.

Benchellali has written about going to Afghanistan at the request of his older brother for several months in 2001. What he thought would be an adventure vacation turned out to be attendance at an al-Qaida training camp, according to his own account. He was captured while trying to leave after the 9/11 terrorist attacks on the U.S., and turned over to American forces, who transferred him to Guantanamo Bay.

The U.S. subsequently released him into French custody in July 2004. He and four others were convicted in 2007 in France of criminal association with a terrorist enterprise but the convictions were overturned in 2009.