Omar Khadr
Omar Khadr has been freed on bail Reuters

A Canada-born former Guantanamo Bay inmate has been freed on bail while he appeals his convictions in the US for war crimes.

Omar Khadr, 28, was set free after 13 years in prison by Canadian Justice Myra Bielby. He was arrested in Afghanistan in 2012 when he was only 15 and admitted killing a US soldier. The judge denied an appeal by the federal government to keep him in custody.

"[Omar] Khadr, you're free to go," Justice Myra Bielby told a packed courtroom in Edmonton, Alberta.

Born in Toronto, Khadr spent 10 years in the US prison in Guantanamo Bay, Cuba. In 2010, he pleaded guilty to five war crimes, including the murder of an American special forces soldier, before a US military commission. Khadr was later transferred to the Millhaven Institution in Bath, Ontario, and then to Alberta.

Amnesty International long campaigned for his release. Bail conditions imposed on him include Khadr must wear an electronic monitoring device, live with his lawyer in Edmonton, observe a nightly curfew and only have monitored contact with his family.

The Canadian Supreme Court ruled in 2010 that Canada breached Khadr's rights by sending spies to interrogate him at Guantanamo in 2003 and 2004.

Khadr was taken to Afghanistan by his father Ahmed Khadr, a senior al-Qaeda member, and sent for training in bomb-making. He was captured in a firefight with US soldiers and lost his vision in one eye.