A former Guantanamo Bay inmate convicted of killing a U.S. soldier will be released on bail Thursday after a judge refused a last-ditch attempt by the Canadian government to keep him jailed.

Court of Appeal Justice Myra Bielby declined a stay request of a lower court judge's decision to grant Omar Khadr bail while he appeals his U.S. war crimes conviction.

Toronto-born Khadr spent a decade in the U.S. prison at Guantanamo Bay, Cuba. Since 2012 he's been held in Canada, serving out an eight-year sentence handed down by a U.S. military commission in 2010. He was convicted of war crimes, including throwing a grenade when he was 15 years old that killed a U.S. soldier in Afghanistan in 2002.

Khadr, 28, was once the youngest detainee at Guantanamo.