A jury has decided that Canadian-born Omar Khadr should serve 40 years in prison after he pleaded guilty to war-crimes charges, but a plea deal will ensure he serves no more than eight years.

As part of the plea deal, 24-year-old Khadr can also apply to return to Canada after one year in U.S. custody.

The jury's recommendation exceeds the prison sentence sought by prosecutors, which was 25 years.

Khadr pleaded guilty to five war-crimes charges, including murder in connection with the death of U.S. Army Sgt. 1st Class Christopher Speer. He admitted to throwing a grenade during a 2002 firefight in Afghanistan that killed Speer, and also confessed to planting roadside bombs and receiving weapons training from al Qaeda.

Prosecutor Jeff Groharing had told jurors Saturday that the world was watching.

"Your sentence will send a message," he said.

The trial took place in Guantanamo Bay, the U.S. military base in Cuba where Khadr has spent the past eight years. It's believed he's the last Western inmate at the facility.

After jurors reached their decision, Khadr's Canadian lawyer, Dennis Edney, said the entire trial was a mistake and his client should have been handled as a child soldier -- Khadr was 15 when he killed Speer.

"The fact that the trial of a child soldier, Omar Khadr, has ended with a guilty plea in exchange for his eventual release to Canada does not change the fact that fundamental principles of law and due process were long since abandoned in Omar's case," Edney said.

"In exchange for repatriation, Omar was required to sign an admission of facts which was stunning in its false portrayal of him."

A spokesperson for Foreign Affairs Minister Lawrence Cannon would not say definitively whether the government would agree to take Toronto-born Khadr back to Canada.

"Should Omar Khadr submit an application, he would be treated like any other Canadian who applies for a transfer," Melissa Lantsman told The Canadian Press in an email. "The decision on any potential transfer will be made in accordance with current law. No decision can be made until an application is received."

CTV legal analyst Steven Skurka said the jury's recomended sentence, although largely symbolic, was likely meant to send a strong message to al Qaeda.

"But what message are you really sending when the jury sentence doesn't matter?" Skurka told CTV News Channel.

"It really points out the system of injustice that permeates Guantanamo Bay, and today really is the icing on the cake."

Hours before the jury's decision, the seven U.S. military officers that made up the panel asked the judge to replay the testimony of Navy Capt. Patrick McCarthy, who worked at Guantanamo Bay from May 2006 to July 2008.

McCarthy worked in the camps where prisoners are kept and later served as the senior military legal adviser at the facility. On Thursday, McCarthy told court that during his time at Guantanamo, he did not see any sign that Khadr had been radicalized. Rather, he remembered Khadr as a pleasant inmate.

"Mr. Khadr was always very respectful," McCarthy testified via video link from Afghanistan, where he is now stationed. "He had a pleasant demeanour. He was very friendly."

McCarthy also told court that Khadr did not attack the guards at Guantanamo as other detainees did, and often helped calm tensions between staff and inmates.

He testified that in his opinion, teenagers should not be held as accountable for their actions as adults. Khadr has been in custody since he was 15. McCarthy also said he believed Khadr could be rehabilitated.

McCarthy's testimony contradicted that of prosecution witness Dr. Michael Welner, who testified that Khadr was an unrepentant terrorist who "marinated in radical jihadism" during his eight years in custody.

With files from The Canadian Press