Image copyright Science Photo Library Image caption The Maldives observes elements of Sharia as well as English common law

A 15-year-old girl who was sentenced to 100 lashes for engaging in premarital sex has had her punishment overturned by a Maldives court.

The High Court ruled on Wednesday that the girl, whose stepfather is on trial for raping her, had been wrongly convicted by a juvenile court of having premarital sex with another man.

Premarital sex is illegal in the Maldives, a popular tourist venue.

The case caused outrage among rights groups who welcomed the latest ruling.

"We are relieved that the girl will be spared this inhumane 'punishment' based on an outrageous conviction, which we hope has also been quashed," said Polly Truscott, Amnesty International's deputy Asia-Pacific director.

It is the government's policy to protect victims, but we had to do it within the framework of the law Masood Imad, Spokesman for Maldivian President Mohamed Waheed

"No-one should ever be prosecuted for sex outside marriage in the first place."

Ms Truscott said that flogging amounted to cruel, inhuman and degrading treatment. She called on the Maldives government to annul all outstanding flogging sentences.

In its ruling the court said the sentence of the lower court was based on a confession that the girl made while she was suffering post-traumatic stress disorder. It said that she had been "unfit for trial" after the alleged rape.

The Maldivian government appealed on behalf of the teenager following international outrage in February to punish her with 100 lashes when she reached the age of 18.

The girl - who cannot be named for legal reasons - was only charged after police investigating the rape allegations discovered that she had been having consensual sex with another man.

Dead baby

President Mohamed Waheed said that he was "overjoyed" with the ruling, his spokesman Masood Imad told the AFP news agency on Thursday.

Mr Imad said: "It is the government's policy to protect victims, but we had to do it within the framework of the law."

The case was sent for prosecution after police were called to investigate a dead baby buried on the island of Feydhoo in Shaviyani Atoll, in the north of the country.

Her stepfather was accused of raping her and impregnating her, then killing the baby.

The legal system of the Maldives, an Islamic archipelago with a population of some 400,000, has elements of Islamic law (Sharia) as well as English common law.