A 15-year-old Indonesian girl who was jailed for having an abortion after being repeatedly raped by her brother has been released after appealing to a higher court.

The Jambi court in Indonesia approved an appeal to reverse the sentence that put the teenager in jail for aborting the baby that was the outcome of repeated rapes by her brother.

The decision was made on Monday, with the court saying that the circumstances in the case required the girl’s release, despite abortion being illegal in Indonesia.

A spokesperson from the Jambi high court said the panel of judges found the abortion to have been performed under coerced circumstances.

Damai Idianto, the girl’s lawyer, said he was overjoyed that his client will go free, The Guardian reported. Women’s rights groups across the country have condemned the sentence and described it as a “legal travesty.”

Ida Zubaidah, from Jambi women’s rights group Beranda Perempuan, praised the decision to release the girl, but also asked authorities to drop charges against the girl’s mother, who allegedly helped her abort the foetus.

The foetus discovered buried near the girl’s house was found to be seven months old after forensic tests.

Read: Protesters urge release of jailed teen raped by brother

Read: Teen girl raped by brother jailed for having an abortion