Sergeant's 18-month sentence for illegal possession of firearm and ammunition is cut and suspended by court of appeal

An SAS sergeant who was ordered to spend 18 months in a military jail for firearms offences walked free after the court of appeal cut his sentence and described him as an exemplary and courageous soldier.

Speaking on the steps of the court shortly after the hearing, Danny Nightingale, 37, said he had been humbled by the support he had received, which included a petition of more than 100,000 signatures demanding his release.

The lord chief justice, Lord Judge, the most senior judge in England and Wales, said Nightingale had behaved with "great folly" by keeping a pistol and ammunition at his army flat in Hereford. But he considered the exceptional circumstances of the case, which included the sniper's 11 years of service in the special forces regiment, meant the punishment imposed by a court martial this month could be reduced to a 12-month suspended sentence.

Lord Judge, who was sitting with Mr Justice Fulford and Mr Justice Bean, said he could not quash the conviction on the evidence put before the court of appeal. A separate hearing would take place.

Nightingale was sent to the military detention centre in Colchester following the court martial after he pleaded guilty to possessing a Glock 9mm pistol and more than 300 rounds of ammunition, including 50 rounds of armour piercing bullets.

He admitted the gun had been given to him in Iraq in 2007, and that he had intended to deactivate it and have it framed as a war souvenir. He had kept the ammunition following training exercises.

The hearing heard Nightingale's memory had been affected by seizures and coma he had suffered while undertaking a 132-mile run in the jungle of Brazil in October 2009. Although he had returned to active duty within a year, the court was told he was still affected by what had happened, and his recollection of how he got the gun and from whom were not reliable.

Lord Judge said he was sure Nightingale had not kept the gun and ammunition for any malevolent purposes, and that the amnesia he had suffered might have contributed to his leaving them in his army home against all military regulations.

"He did not quite, or could not quite, get around to dispose of them. In short, this was an offence of great folly, but not one for personal gain," he said.

Lord Judge said Nightingale's life was a "remarkable story" that had taken him on dangerous missions in Northern Ireland, Bosnia, Lebanon, Turkey, Iraq, Afghanistan, Syria and Libya.

He had also helped develop a medical dressing known as the Nightingale bandage which is used by the military and paramedics to help soldiers and civilians suffering from serious chest injuries.

Lieutenant Colonel Richard Williams, Nightingale's commanding officer in Iraq, told the court he was an "exceptionally good soldier, who was unusually sensitive and compassionate in nature."

Nightingale's barrister, William Clegg, QC, said: "If ever there was a exceptional case where an immediate period of detention is not necessary, it is this."

In his summing up, Lord Judge said Nightingale and other SAS colleagues had been involved in "desperately serious operations against a ruthless enemy", and that this fighting was "relentless, exhausting and dangerous".

Throughout all this, Nightingale had remained "a quiet, tough, stalwart soldier … who required neither praise or thanks".

Standing alongside her husband after his release, Sally Nightingale said: "It can only be good for all the troops out there fighting for our country to see justice has been done."

The defence secretary, Philip Hammond, said: "I am delighted for Sergeant Nightingale and his family that he will be home not only before Christmas as they'd hoped, but by the end of November. The justice system has worked. I was pleased that an appeal was heard quickly and it is right that a court should decide on whether the sentence was appropriate. The Court of Appeal has decided the sentence was too harsh and has freed him."