London (CNN) -- A British special forces soldier was freed from prison Thursday after an appeals court shortened and then suspended the sentence he was serving for keeping a pistol presented to him by Iraqi forces in 2007.
The court initially reduced Sgt. Danny Nightingale's 18-month sentence to 12 months and then suspended it.
The soldier, an 11-year veteran of the British military's Special Air Service, was released from custody shortly after the court's ruling and was greeted by his wife and father.
British Defence Secretary Philip Hammond said he's delighted that Nightingale is going home.
"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," Hammond added. "The Court of Appeal has decided the sentence was too harsh and has freed him."
The initial sentencing earlier this month sparked outrage across Britain. Nightingale had pleaded guilty to illegally possessing a firearm and ammunition, on the understanding that he would be granted leniency at his court martial.
The soldier was given the gun by Iraqi forces he had been training, and was to give it to his SAS regiment as a war trophy. But the deaths of two comrades in a helicopter crash sent Nightingale back to Britain, and his belongings were packed for him in Iraq and sent home -- including the weapon.
When the gun was discovered by military police years later, it was still in a locked box -- unopened since it was presented to him.
Nightingale's lawyer said the soldier suffered a memory loss after he collapsed during a charity marathon in the Amazonian jungle in 2009 and remained in a coma for three days.
High-profile SAS veterans sent an open letter to British Prime Minister David Cameron after Nightingale was sentenced, asking Cameron to release the soldier.
Lawyers for Nightingale say they now intend to appeal his original conviction, to clear the name of a man many see as a betrayed war hero.