Afghan President Hamid Karzai on Thursday pardoned an Afghan woman serving a 12-year prison sentence for having sex out of wedlock after she was raped by a relative.

Karzai’s office said in a statement that the woman and her attacker have agreed to marry. That would reverse an earlier decision by the 19-year-old woman, who had previously refused a judge’s offer of freedom if she agreed to marry the rapist.

Her plight was highlighted in a documentary that the European Union blocked because it feared the women featured in the film would be in danger if it were shown.

More than 5,000 people recently signed a petition urging Karzai to release the woman. She had the man’s child while in prison and raised her daughter behind bars, which is common among women imprisoned in Afghanistan.