Amina Sboui, a Tunisian activist with the topless protest group Femen, was released from jail on Thursday pending her trial for desecrating a cemetery.
Sboui, 18, left the women's prison in Sousse, south of Tunis, where she has been held since May 19, and her supporters issued a photo of her making a victory sign after she was freed.
“She is with her family,” her lawyer Ghazi Mrabet told AFP. He said he hoped arrangements had been made to look after her security, as radical Islamists have threatened Sboui in the past.
Several hours earlier, the Tunisian judiciary ordered the release of the activist ahead of her trial.
Another of her lawyers, Halim Meddeb, described the court's move as a “big surprise.”
The young woman faces trial for painting the word “Femen” on a cemetery wall in protest at a planned meeting of radical Sunni Muslim Salafists in the central city of Kairouan.
Sboui's mother expressed her joy at the release, saying: “I will finally have her in my arms. The judiciary has showed that it is independent.”
Amina sparked both scandal and a wave of online support after she was threatened by Tunisia's increasingly active hardline Islamists for posting topless pictures of herself on Facebook earlier this year.
Her family said she suffered from chronic depression and had suicidal tendencies, and they prevented her from going out, claiming her safety was at risk.
But the young woman, who accused her relatives of holding her in captivity and beating her, ran away from home in April and had regularly appeared in public before her detention in May, although never topless.
The Femen movement, founded in Ukraine and now based in Paris, has flourished since 2010, with feminists around the world stripping off in protest at a wide range of issues linked to the mistreatment of women, but also against dictatorship.
At the end of May, three Femen activists -- two French and a German -- were arrested after bearing their breasts outside the main Tunis courthouse, in a demonstration of support for Amina.
The arrest of the three women triggered international condemnation and they were released a month later.
Tunisia Femen activist freed pending trial