A former child refugee from Somalia who was shuffled between Nova Scotia foster and group homes as a youth, and who as an adult now faces deportation, was released Wednesday from immigration detention.

Abdoul Abdi had spent two weeks detained in jails in the Maritimes and Ontario on immigration grounds after serving a four-year prison sentence for aggravated assault.

His lawyer, Ben Perryman, said Abdi told him it felt "unreal" to be free and that he wanted to thank people who had supported him in his quest to be released and to remain in Canada.

Abdi, 24, is now required to live in a Toronto halfway house, according to his lawyer, but his legal battle to stay in Canada continues. He could be deported to Somalia because of his criminal past and because he's not a Canadian citizen.

Abdi arrived in Nova Scotia when he was six with his aunts and sister, and was put in the care of the Department of Community Services, which never applied for citizenship on his behalf.

The federal public safety minister is still pursuing a deportation hearing, according to Perryman, although it has not yet been scheduled.

Abdi is challenging his deportation in Federal Court. Perryman said the Department of Justice has filed a "notice of appearance," the first step in opposing Abdi.

The lawyer said he's hopeful the government will stop its efforts to deport Abdi and that his case can be resolved without going through court.

With files from Rosemary Barton