The former SAS sniper Danny Nightingale has firmly denied that a gun and ammunition found in his bedroom belonged to him, despite originally telling police the weapons were his and pleading guilty to the offences in a court.

Nightingale told a court martial that he suffered memory blanks as a result of an illness he suffered while taking part in an endurance run in the Amazon and had "confabulated" – filled in the gaps with false versions of how he came by the weapon and ammunition.

The soldier's case is that the pistol and ammunition belonged to another member of the SAS with whom he shared the house where the items were found.

Giving evidence at Bulford military court in Wiltshire, Nightingale, 38, told how he joined what was described as "the unit" in 2001. He said his specialist skills included driving, medical work, den making and surveillance as well as sniping.

The court was told that he had invented a type of dressing for chest wounds that was used by the military across the world and by ambulances services in the UK and US.

Nightingale revealed that he served in Iraq in 2007, and became emotional as he recalled seeing two colleagues die in a helicopter crash. He described suffering his serious illness in 2009, during which he spent three days in a coma, which had left gaps in his memory.

In September 2011, he and his housemate were serving in Afghanistan when they were told their home in the UK had been raided and guns and ammunition found.

The housemate, identified as soldier N, has admitted one of the two Glock pistols found in the house and much of the ammunition was his and is serving a two-year sentence.

Originally Nightingale said the other pistol belonged to him and had been given to him by Iraqis he worked alongside in 2007. He said he had accumulated the ammunition – more than 300 rounds – because he worked as a range instructor and had kept some of it at home, rather than return it to stores, to save time.

But in the witness box on Friday, Nightingale said he was a "diligent" soldier who would not have operated in such a way.

Asked by his barrister, William Clegg QC: "Today do you believe that the gun was given to you by an Iraqi national?"

Nightingale replied: "I do not."

Clegg: "Do you believe the gun was yours?"

Nightingale: "I do not."

Clegg: "Today do you believe that the ammunition was yours left over from the range?"

Again Nightingale replied: "I do not." He said he got to know very few Iraqis while he was there, and only got along well with one.

Clegg told the board hearing the case that Nightingale's earlier admission to police and in court were "false confessions".

He suggested the Glock pistols had been brought into the UK by soldier N. He had good reason to try to pass the blame for one of them as to have two made it look as if he had been collecting them. "One can be a souvenir; two begins to suggest a collection," said Clegg.

The barrister claimed Nightingale had "deep underlying problems with his mind", adding that his brain made up for lack of memory by confabulating and might have latched on to N's explanations of how he came by the weapon (a present) and ammunition (left over from the range) as his own when he was told the equipment had been found in his room.

Earlier the board was shown DVDs of interviews Nightingale had given to civilian and military police.

In September 2011, the month the weapon and ammunition were found, he told detectives from West Mercia police: "The pistol that was found in the back bedroom, I got that from someone I was working with in Iraq. I brought it back from Iraq. It was a trophy."

Pressed about the pistol, Nightingale said the weapon had been given to him in 2007 as a keepsake by Iraqis he had been training in Baghdad. "It was given to me by the guys I was training out there. They enjoyed what we did. They knew I liked the weapon."

He said he intended to decommission it: "I never got round to it, which is very naive. I apologise profusely for it, that's how it happened."

The former sniper said he had not fired the pistol but had stripped and reassembled it and knew that it contained all the working parts.

He said he accumulated the ammunition while working as a range instructor. He said it ought to have been checked back into stores or an amnesty bin but had not been because of his "poor administration". "It should have gone back; it didn't," he said.

Nightingale insisted there had been no malice in his keeping the weapon and ammunition. He said life was hectic and he had not found time to have the pistol decommissioned and to hand back the ammunition. But he said he knew he was "in the wrong. I haven't got any excuse."

In January 2012, he told military police officers he had planned to give the pistol to his regiment as a farewell present when he left the SAS. He said he had been given the pistol as a gift from Iraqis who had been working for British intelligence.