A former child refugee from Somalia at risk of being deported will soon be set free, but his fight to stay in Canada isn't over.

Abdoul Abdi, who spent the last week and a half detained on immigration grounds in jails in the Maritimes and Ontario after serving a four-year prison sentence, could be released as early as tomorrow, according to his lawyer, Ben Perryman.

On Monday, an Immigration and Refugee Board member ordered that Abdi be released from immigration detention and transferred to a halfway house in Toronto.

"For Mr. Abdi it means that he can have his liberty back," said Perryman. "Our position all along was that this detention has been both unlawful and unnecessary, and that it's deprived Mr. Abdi of his liberty."

UPDATE: <a href="https://twitter.com/hashtag/AbdoulAbdi?src=hash&ref_src=twsrc%5Etfw">#AbdoulAbdi</a> has been ordered released from detention by the Immigration and Refugee Board. He will likely be transferred to a halfway house tomorrow. Canada continues to pursue his deportation. —@bnperryman

The federal government wants Abdi sent back to Somalia because of his criminal past and the fact he's not a Canadian citizen.

The 24-year-old arrived in Nova Scotia at the age of 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 difference between the hearing Monday and Abdi's first detention hearing last week is that representatives of Public Safety Minister Ralph Goodale agreed with his release, said Perryman.

Abdoul Abdi is shown in Halifax provincial court in this 2013 file photo. (CBC)

But Canada still wants him sent back to Somalia, he said.

"So we are still in the same position we were before, it's just that Mr. Abdi doesn't have to be in jail while that battle continues."

In an email to CBC News, a spokesperson for Goodale's department said it won't comment on specific cases due to privacy and that Canada's immigration system "has a robust assessment process and multiple safeguards."

Abdi was supposed to go to a halfway house when he got out of prison on Jan. 4 after serving about four years for crimes that included aggravated assault.

Perryman continues to fight Abdi's deportation in Federal Court.

Fatouma Abdi, Abdi's sister, has been fighting to have her brother stay in Canada where he's spent most of his life. (Mark Crosby/CBC)

Abdi's case has continued to receive national attention, and both Prime Minister Justin Trudeau and Nova Scotia Premier Stephen McNeil have expressed concern.

Perryman said what he finds "unfathomable" is that even with this support the deportation process continues.

"If the highest leaders in our land at the federal and provincial level are signalling that, then there needs to be a response from Minister Goodale to end what Mr. Abdi is experiencing, and do the just thing, and I would say the moral thing, and the thing that many Canadians across the country are calling for," he said.