SYDNEY, N.S. - A soldier accused of shooting and killing a colleague in a tent in Afghanistan over two years ago says he felt his life was threatened by someone when he whirled and fired his weapon.

Cpl. Matthew Wilcox took the stand in his own defence Friday in his manslaughter trial and told the four military jurors he heard someone cocking a pistol.

He told a hushed military courtroom that "he just reacted" and turned quickly, drawing his gun from his holster before shooting "at the pistol."

Wilcox told defence counsel Lt.-Col. Troy Sweet he only realized seconds later that he had shot one of his best friends, Cpl. Kevin Megeney.

"I felt my life was threatened and lethal force was the minimum force needed," said Wilcox.

"There was a weapon pointed at me."

He said he realized it was Megeney two seconds after pulling the trigger.

"Only after the recoil of my weapon did I realize it was him," he added.

"Everything happened so quickly, in less than two seconds. I was just reacting to a threat against my life."

Wilcox, 24, of Glace Bay, N.S., has pleaded not guilty to charges of manslaughter, criminal negligence causing death, and negligent performance of duty in the death of Megeney, 25, of Stellarton, N.S.

The prosecution has argued that Wilcox was playing a game of "quick draw with Megeney on March 6, 2007. "

Wilcox said many people in Afghanistan carry weapons and he regarded a gun being pointed at his back as a potentially deadly threat.

For days afterward, he said he felt shock and emptiness.

Wilcox said when he came back to Canada, deep grief and sadness set in over the death of Megeney.

"He was a really good guy," he said.

"He was probably my closest friend in Afghanistan. ... We lived together for almost a year and saw each other almost every day."

Asked if he believed he was playing a game of "quick draw," where soldiers see who is the quickest to bring the weapon from their holster, he replied firmly, "No."

However, Maj. Jason Samson, one of two prosecutors in the case, suggested in his cross-examination that Wilcox's training should have taught him to assess the situation before he fired his gun.

"Why would you say it's reasonable for you to assume any Afghani got through ... with a weapon?" he asked.

At first, Wilcox argued it was "possible" a Taliban member was in the tent.

He said he had turned slightly and was focused on the pistol's barrel, not on the person holding it.

"Anyone could have been in the tent," said Wilcox.

But later, as Samson pressed him, he conceded it was unlikely that the person would have been anyone but Megeney.

"If someone was in there it would most likely be Cpl. Megeney," he testified.

Wilcox had entered the tent ahead of Megeney, dropped of his own gear, and then went back outside to carry in the gear of another soldier while Megeney was outside talking.

He said it was just after laying down that gear that he thought he heard the bolt of a gun sliding and had his "instinctive" reaction.

Wilcox spoke clearly and loudly, though he seemed nervous at times, and glanced over at his defence lawyers frequently.

During testimony he outlined how he had been in a hurry at the end of his shift as a guard at one of the Kandahar base's entrance.

He said that he realized Canadian commanders required him to unload his weapon after he left his post, and said he had taken the magazine out of his pistol in order to fulfil that order.

However, he added, he had trouble shoving the magazine into a separate compartment on a leg holster, and instead jammed the magazine back into the gun.

Samson repeatedly asked him if he realized that decision broke basic military rules, and Wilcox acknowledged it was against orders.

When the prosecutor asked him if it was careless, he replied: "Yes."

Wilcox's appearance in his own defence followed 19 days of testimony by 25 witnesses called by the prosecution.

Earlier testimony in the court martial suggested the two reservists were playing "quick draw" in their tent at Kandahar Airfield, when a Browning pistol went off and hit Megeney in the right side of his chest.

The trial has heard from a soldier who said he saw Wilcox hold his dying friend in his arms and apologize as Megeney slumped to the floor of their tent.

And Master Cpl. Kyle Keigan testified that Wilcox told him over drinks in Sydney several months after the shooting that he was playing "quick draw" with Megeney.

On Friday, Wilcox denied saying that to Keigan.

He said he told him there was "a rumour" of a game of quick draw being played but that people were jumping to conclusions before they had heard all of the facts.

The court was told a group of soldiers carried Megeney by stretcher to a base hospital just 200 metres from where he was shot.

He died about 30 minutes later.Both Wilcox and Megeney were members of 1 Platoon, force protection company, which was responsible for protecting Kandahar Airfield.

The trial is being held before a four-member military panel and a judge, Cmdr. Peter Lamont.

The cross-examination of Wilcox will continue on Monday.