Cpl. Matthew Wilcox is charged in the 2007 shooting death of Cpl. Kevin Megeney at Kandahar. ((Andrew Vaughan/Canadian Press))

A Nova Scotia reservist charged with killing a fellow soldier in Afghanistan says he heard a gun being cocked and fired out of fear he would be shot.

Cpl. Matthew Wilcox, from Glace Bay, took the stand Friday at his court martial in Sydney. He told the four-juror panel he walked into the tent he shared with Cpl. Kevin Megeney, heard the slide of a pistol and then saw a gun pointed right at him.

Wilcox said he felt his life was threatened and determined that "lethal force" was needed. He quickly fired his own weapon.

It was only after Megeney fell to the floor that he realized what happened, Wilcox told the panel.

"Only after the recoil of my weapon did I realize it was him," he said. "Everything happened so quickly, in less than two seconds. I was just reacting to a threat against my life."

He refuted the prosecution's suggestion that he and Megeney were playing a game of quick draw.

Wilcox is charged with manslaughter and negligent performance of a military duty in the March 6, 2007, death of Megeney, from Stellarton, N.S.

Wilcox said he was in shock for days after the shooting and grieved deeply for his friend.

Megeney was a "really good guy," Wilcox told the panel. "He was probably my closest friend in Afghanistan."

In previous days' testimony, the panel heard that Megeney was hit in the right side of the chest and died 30 minutes after several soldiers carried him to a nearby hospital on the Kandahar base.

With files from The Canadian Press