Afghan President Hamid Karzai has pardoned a rape victim who was jailed for adultery, after she apparently agreed to marry her attacker.
A government statement said she agreed to the marriage, although her lawyer said she did not wish to marry him.
The woman, named as Gulnaz, gave birth in prison to a daughter who has been kept in jail with her.
Human rights groups say hundreds of women in Afghan jails are victims of rape or domestic violence.
Gulnaz’s lawyer told the BBC she hoped the government would allow Gulnaz the freedom to choose whom to marry.
“In my conversations with Gulnaz she told me that if she had the free choice she would not marry the man who raped her,” said Kimberley Motley.
Ms Motley told the BBC that Gulnaz’s release was not conditional on her marrying the rapist.
The case has drawn international attention to the plight of many Afghan women 10 years after the overthrow of the Taliban.
Earlier this month, Gulnaz said that after she was raped she was charged with adultery.
“At first my sentence was two years,” she said. “When I appealed it became 12 years. I didn’t do anything. Why should I be sentenced for so long?”
The most recent appeal saw her sentence reduced to three years.
‘Marriage with conditions’
Some 5,000 people signed a petition for Gulnaz’s release. News of her pardon came in a statement from the presidential palace.
It said a meeting of the judiciary committee had “discussed the issue of rape… and the issue of her imprisonment”.
“As the both sides [Gulnaz and the rapist] have agreed to get married to each other with conditions, respective authorities were tasked to take action upon it according to Islamic Shariah [law],” it said.
“The president ordered the office of administrative affairs and the secretariat of the council of ministers to make the decree of Gulnaz’s release.”
The attack on Gulnaz was brought to light by her pregnancy. Her attacker – her cousin’s husband – was jailed for 12 years, later reduced on appeal to seven years.
Her story was included in a European Union documentary on Afghan women jailed for so-called “moral crimes” – however, the EU blocked its release.
The EU said it decided to withdraw the film – which it commissioned and paid for – because of “very real concerns for the safety of the women portrayed”.
The EU’s Ambassador and Special Representative to Afghanistan, Vygaudas Usackas, said on Thursday he was “delighted” to hear Gulnaz was to be freed.
“Her case has served to highlight the plight of Afghan women, who 10 years after the overthrow of the Taliban regime often continue to suffer in unimaginable conditions, deprived of even the most basic human rights,” he said.
“While we applaud the release of Gulnaz, on the orders of President Karzai, it is the hope of the European Union that the same mercy that has been extended to Gulnaz is applied to all women in similar circumstances.”
Human rights workers criticised the EU for withdrawing the documentary, saying the injustice in the Afghan judicial system should be exposed.
Half of Afghanistan’s women prisoners are inmates for “zina” or moral crimes.
The BBC’s Bilal Sarwary says recent cases of violence against women are embarrassing for the Afghan government.
Many Afghan women rights activists say there must be an end to the culture of impunity and police must punish all those behind violence against women, he adds.