A court in Somalia has dropped charges against a woman who was given a jail sentence after alleging she was raped by security forces.
She and a journalist who interviewed her were convicted a month ago by a Mogadishu judge on charges of offending state institutions.
The appeal court said the woman would be freed but the journalist who did not report the story would stay in jail.
Abdiaziz Abdinur Ibrahim, 25, had his sentence cut to six months.
The case prompted an outcry last month from human rights groups and journalists, who said it was politically motivated. UN Secretary General Ban Ki-moon said he was "deeply disappointed".
Both the woman and the journalist were originally given one-year jail terms, but the trial judge said the woman would not be imprisoned for six months as she was caring for a baby.
She had reported the alleged rape at a police station in Mogadishu and prosecutors alleged she and others had been paid by Abdinur to lie. She was convicted after the judge cited disputed medical evidence saying she had not been raped.
The journalist, who was detained in January, was accused by police of collecting material for an al-Jazeera media report on rape in camps for displaced people. He had been working for Somali radio stations and international media but had not been involved in the story in question, the network said.
His lawyer told the BBC last month that he had been prevented from producing witnesses in court.
Human Rights Watch criticised the decision to keep Abdiaziz Abdinur Ibrahim in jail.
"The court of appeals missed a chance to right a terrible wrong," Africa director Daniel Bekele said in a statement.
A new government backed by the UN came to power last September, after eight years of transitional rule.
Somali has seen more than 20 years of conflict which saw clan-based warlords, rival politicians and Islamist militants battle for control of the country.