A Somali appeals court dropped charges on Sunday against a woman sentenced to a year in jail after she told a reporter she was raped by security forces, but the journalist will remain behind bars.
The case in which the pair was convicted of "offending state institutions", has drawn international criticism with United Nations chief Ban Ki-moon saying he was "deeply disappointed".
"The court orders the release of the woman, while the journalist will spend six months in jail for offending state institutions," Judge Hassan Mohamed Ali said, cutting reporter Abdiaziz Abdinuur's original one-year sentence in half.
"The court has learned that the journalist misled the alleged rape victim into the interview," the judge added.
Abdinuur, 25, was detained on January 10 while researching sexual violence in Somalia, but did not air or print any report 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, a practice HRW said was an "unscientific and degrading practice that has long been discredited".
The woman, who had originally been granted a six-month reprieve before the start of her jail term to allow her to breastfeed her infant child, walked free from the court in the capital Mogadishu after the ruling.
But Abdinuur was led away in handcuffs and put into a truck that took him back to the central prison, sparking angry reactions from rights groups and fellow journalists.
"This is completely insane and unjust," said Omar Faruk Osman from Somalia's national journalists' union.
"How can they jail someone for interviewing a victim? The lawyers will appeal again and take the case to the Supreme Court."
Abdinuur works for several Somali radio stations and international media.
Amnesty International, Human Rights Watch (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.
Daniel Bekele, HRW's Africa director, criticised the continued jailing of Abdinuur.
"The court of appeals missed a chance to right a terrible wrong, both for the journalist and for press freedom in Somalia," Bekele said in a statement.
"The government has argued that justice should run its course in this case, but each step has been justice denied."
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.
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 he was "happy to see the appeal court verdict on the rape victim" but that he had been "hoping for a different outcome" for the reporter.
"Journalists should not be sent to prison for doing their job," he said in a message on Twitter, but added it would have been "inappropriate for the government to interfere" in the country's judiciary.
"Our independent judiciary is new... We are nurturing new institutions in Somalia, not throttling them at birth," he added.