Cpl. Matthew Wilcox, centre, is escorted from his court martial during a break in proceedings in Sydney, N.S., on Tuesday. Cpl. Matthew Wilcox, centre, is escorted from his court martial during a break in proceedings in Sydney, N.S., on Tuesday. (Andrew Vaughan/Canadian Press)

A Nova Scotia soldier has been sentenced to four years in prison and dismissed from the military for fatally shooting his tentmate in Afghanistan.

Cpl. Matthew Wilcox, 24, stood silently as he was sentenced Wednesday in Sydney.

Wilcox was convicted in July of negligent performance of duty and criminal negligence causing death in the shooting of Cpl. Kevin Megeney, 25, in Kandahar in 2007.

"I am satisfied beyond a reasonable doubt that the shot that killed Corporal Megeney was accidentally discharged in the course of horseplay with guns engaged in consensually, by both the offender and the deceased," said the military judge, Cmdr. Peter Lamont.

Cpl. Kevin Megeney, 25, was fatally shot in his tent in Afghanistan. Cpl. Kevin Megeney, 25, was fatally shot in his tent in Afghanistan. (DND/Canadian Press)

The defence is planning to appeal the conviction and sentence. On Wednesday evening, Wilcox's application for release during the appeal process was denied and he was escorted out of the courtroom.

He was to spend the night at the Sydney garrison and be transported to the military prison at Canadian Forces Base Edmonton. It's not clear if he will serve his entire sentence there.

In handing down the sentence, Lamont noted that Wilcox was described by senior officers as a capable soldier but he was negligent in using the weapon he was trained on and lost the trust of his fellow soldiers.

"The conduct of the offender was part of a pattern of negligent behaviour that began with the offender's failure to unload his weapon at the end of the workday," said Lamont.

The judge handed Wilcox, from Glace Bay, the minimum sentence for civilians under the Criminal Code of Canada. He also banned him from owning or using any weapon for five years.

Members of the Wilcox family wept as the judge took about 40 minutes to read out his decision from a laptop. Some gasped when they heard the prison term.

The Megeney family sat quietly throughout the proceedings.

Lamont also acknowledged the friendship between Wilcox and Megeney — both reservists with the Nova Scotia Highlanders.

"I have no doubt that he himself has suffered greatly from the death of his friend," said the judge.

During the nine-week trial, Wilcox testified he heard a gun being cocked behind him and fired his 9-millimetre Browning pistol in self-defence.

He said he only realized it was Megeney when he saw the body lying on the ground of the tent they shared at Kandahar Airfield.