HALIFAX - A soldier who fatally shot his close friend in Afghanistan in 2007 is being released from a Nova Scotia prison pending his appeal before the Court Martial Appeal Court of Canada.

Defence lawyer Lt.-Col. Troy Sweet says Matthew Wilcox will leave Springhill penitentiary and begin living with his parents in Glace Bay, N.S., by late Monday or early Tuesday.

Wilcox was sentenced by a military judge to four years in jail and dismissed from the military after he was found guilty of criminal negligence causing death and neglect of military duty in the shooting of Cpl. Kevin Megeney.

Megeney died on an operating table in Kandahar after Wilcox fired a bullet through his chest on March 6, 2007.

Wilcox's lawyers have filed an appeal of his conviction and sentence, arguing that the makeup of the military jury was unfair and that its members should have been permitted to view the scene of the shooting in Kandahar.

However, military judge Cmdr. Peter Lamont ruled during sentencing on Sept. 30 that Wilcox would have to go to prison until the appeal is heard by three Federal Court judges.

But on Monday, those judges ruled Wilcox should be free until they hear the appeal.

Sweet said his client was "pleased by the outcome" after spending 60 days in the military prison in Edmonton and over a week at the Springhill prison.

Wilcox will have to sign undertakings to remain with his parents, be of good behaviour, report to police when required and attend court when required.

The defence lawyer said the Federal Court judges ruled that the military judge "didn't go into sufficient detail with respect to why it was necessary to keep him (Wilcox) in custody at this time."

During the military trial, Lamont said the conduct of the offender was part of a pattern of negligence that began with Wilcox's failure to unload his firearm after he finished his shift.

He said Wilcox had "violated the trust" of his colleagues and he referred to the shooting in the tent as being the result of "horseplay" with arms.

However, defence lawyers argue in the notice to appeal that there were numerous legal flaws in the court martial.

The document states that the military jury should have had five members, rather than the four who were chosen, and it should have included another non-commissioned officer.

The defence lawyers are also arguing that the court martial should have been held in Afghanistan so the military jury could view the scene of the crime.