A Canadian judge has ruled that a war crimes sentence for former Guantanamo Bay prisoner Omar Khadr has expired.

Monday's ruling means he no longer faces the threat of returning to prison.

The Canadian-born Khadr was 15 when he was captured by U.S. troops at a suspected al-Qaida compound in Afghanistan.

He pleaded guilty in 2010 and was sentenced to eight years plus the decade he had already spent in custody at the American prison. He returned to Canada from Guantanamo Bay two years later to serve the remainder of his sentence and was released in 2015 pending an appeal of his guilty plea, which he said was made under duress.

His sentence would have ended last October, but a judge freed him on bail, effectively extending his sentence.