Omar Khadr’s lawyer is arguing that the former Guantanamo Bay prisoner is being held illegally in a federal prison and should be released immediately.

In brief filed in Edmonton Court of Queen’s Bench last week, Dennis Edney argues that Khadr, 26, is being improperly held as an adult for crimes he committed as a youth in Afghanistan.

Under a plea deal reached in October 2010, a U.S. military commission sentenced Khadr to eight years in custody, but Edney argues that sentence doesn’t exist in Canada for adults, where the penalty for murder is life in prison.

"Had the five offences had been committed in Canada, an eight-year sentence could only have been imposed as a youth sentence," the document states.

"An eight-year sentence could not have been imposed as an adult sentence."

Edney argues that the International Transfer of Offenders Act states that as a youth, Khadr can only be held in a provincial facility, not the Edmonton Institution, the federal prison he was moved to earlier this year.

"The respondent's ongoing custody of the applicant is unlawful and must be terminated," the brief states.

In a written statement, Minister of Public Safety Stephen Blaney said that Ottawa will fight any attempt to free Khadr before his sentence is complete.

"Omar Khadr pleaded guilty to very serious crimes, including the murder of American army medic Sgt. Christopher Speer," he said.

"The government of Canada will vigorously defend against any attempted court action to lessen his punishment for these crimes."

Khadr was 15 years old in 2002 when he was taken into custody for the death of an American soldier after he was discovered in the rubble of a bombed-out compound in Afghanistan after a firefight with U.S. forces.

Khadr pleaded guilty to five charges, including the murder of Sgt. 1st Class Christopher Speer and providing material support for terrorism, in exchange for returning to Canada to serve his sentence.

Khadr was returned to Canada last fall and incarcerated in Millhaven Institution near Kingston, Ont., before being moved to Edmonton in May.

Edney plans to make the habeas corpus application in Court of Queen’s Bench next month.

In a letter, the federal Department of Justice states that Khadr’s detention in a federal penitentiary is appropriate under the International Transfer of Offenders Act.