A Canadian court has freed Omar Khadr, a former Guantanamo Bay inmate on bail, rejecting previous attempts by the government to keep him in prison.

"You are free to go," Alberta Court of Appeal's Myra Bielby said on Thursday, despite pleas by the government to keep Khadr in prison while he appeals a US war crimes conviction.

Justice Bielby rejected the argument that releasing the 28-year-old would cause irreparable harm to Canada's diplomatic ties and jeopardise the pending transfers of an estimated 300 other Canadian prisoners from foreign jails.

A Canadian-born national, Khadr was captured in Afghanistan in 2003 when he was 15, and was convicted of throwing a grenade that killed US army sergeant Christopher Speer during a 2002 firefight.

He spent a decade at Guantanamo Bay, Cuba, and was handed an eight-year sentence by a US military commission in 2010 for the war-crime charges.

Khadr told reporters that he will prove that the court made the right decision.

"I'd like to thank the Canadian public for trusting me and giving me a chance," he said.

"It might be some time, but I will prove to them that I am more than what they thought of me and I will prove to them that I am a good person."

Khadr will be living with his long-time lawyer Dennis Edney, as a condition of his bail, reported Al Jazeera’s Canada correspondent Daniel Lak.

He will wear an ankle monitor to keep track of his movement and will have limited contact with his own family in Toronto.

Khadr intends on continuing to study for his high school diploma which he could get this year or next. After that, Edmonton’s Kings University College has said he’s welcome to study there if he so chooses, reported Lak.

His internet access will be restricted and monitored. And he will have to be back in court for yet another appeal by Ottawa against bail in September.

"I think it would be wonderful to restore this young man, back into society, give him the opportunities that he's never had so that he can contribute to society," Edney told Al Jazeera.

"I have every faith he can do that, and what does that say about redemption."

Defence attorneys had argued Khadr was taken to Afghanistan by his father, Ahmed Said Khadr, an alleged senior al-Qaeda financier whose family stayed with Osama bin Laden briefly when Khadr was a boy.

His Egyptian-born father was killed in 2003 in a Pakistani military operation.

Khadr has frequently been called a "hardened terrorist" by the Canadian government, and the Canadian Prime Minister Stephen Harper's Conservative government has long refused to support Khadr, reflecting ambivalence in Canada over the Khadr family.

Yet Khadr has become a beacon for civil rights campaigners who say he was a juvenile when arrested and should have been treated much more leniently by both the US and Canada, reported Lak.

Amnesty International has launched a campaign in support of Khadr, calling for the public to send him messages of support.

Khadr was subjected to brutal treatment on his way to Guantanamo and at the base detention centre.

Canada not only condoned such treatment, it sent spies and diplomats to take part in his interrogation and obtained information that the Supreme Court of Canada later declared inadmissible because it was obtained under duress, even torture.

The Canadian Supreme Court ruled in 2010 that Canada breached Khadr's rights by sending intelligence agents to interrogate him at the US naval base in Cuba, in both 2003 and 2004, and by sharing the results with the United States.

Khadr is therefore suing Canada’s government for about $50mn, alleging violation of fundamental rights, allowing torture by US forces and for treating him like an adult offender when he was arrested as a child.