Somalia's Supreme Court on Sunday freed a reporter imprisoned for interviewing a woman who alleged she had been raped by soldiers, in a case that sparked widespread international criticism.
Supreme Court judge Aidid Abdulahi Ilkahanaf said the charges had been dropped and the court "has given journalist Abdiaziz Abdinuur his freedom back".
Both Abdinuur and the woman were initially sentenced to a year in prison for "offending state institutions". But all charges were dropped against the woman earlier this month, while Abdinuur's sentence was halved.
His release, following more than two months' incarceration and after an appeals court ruled he must remain in jail, came as a surprise to many.
The reporter walked out of the courtroom offering prayers of thanks for his release and thanking those who had supported him.
"I'm very happy that I got my freedom back, I thank those who worked in this process that helped my release including my lawyers", he said.
Abdinuur was detained on January 10 while researching sexual violence in Somalia, but did not air or print a story after interviewing the woman.
He was also found guilty of "making a false interview, and entering the house of a woman whose husband was not present".
The court had initially deemed the woman's story to be false after a midwife conducted a "finger test" to see if she had been raped, which Human Rights Watch (HRW) said was an "unscientific and degrading practice that has long been discredited".
When she was sentenced, the woman was allowed to defer her prison term for six months to breastfeed her infant.
UN chief Ban Ki-moon said at the time he was "deeply disappointed" over the case.
Abdinuur works for several Somali radio stations and international media outlets.
Amnesty International, HRW and the Committee to Protect Journalists said in a joint statement during the trial that the case was "linked to increasing media attention given to the high levels of rape" including by security forces in the country.
Somalia has been ravaged by conflict since 1991, but a new UN-backed government took power in September ending eight years of transitional rule by a corruption-riddled government.
Many have said the new government offers the most serious hope for stability since the fall of dictator Mohamed Siad Barre in 1991.
Prime Minister Abdi Farah Shirdon said earlier this month that "journalists should not be sent to prison for doing their job," but that it would be "inappropriate for the government to interfere" in the country's judiciary.
Since the start of the case, rights groups and Somalia's journalist union have warned that security forces have continued to crack down on the media.
The release comes days after Shirdon visited overcrowded Mogadishu's central prison, where he described conditions as "deplorable" following the death of two prisoners due to cholera.