Hadijatou Mani (2nd right) and her child with the judges outside the Ecowas court before her hearing in Niamey, Niger

A court in west Africa today convicted Niger of failing to protect a young girl sold into slavery in a landmark judgment with potentially far-reaching implications for the tens of thousands of enslaved Africans.

The justice arm of the Economic Community of West African States (Ecowas) ruled that Niger failed in its obligations to protect Hadijatou Mani.

Mani, who brought the test case with the assistance of British anti-slavery groups, said she was sold into slavery at the age of 12 for about £325 and regularly beaten and sexually abused.

The court dismissed a second element of the case that accused Niger's government of legitimising slavery through customary laws that campaigners say discriminate against women.

Slavery remains common in rural areas of Niger despite it being officially abolished five years ago.

"I am very happy with this decision," Mani told Reuters after the ruling was announced.

The court, sitting in the capital, Niamey, ordered the state to pay her 10 million CFA francs (about £12,000) in damages and accumulated interest.

"We are law-abiding and will respect this decision," Mossi Boubacar, a legal official for Niger's government, told Reuters.

The ruling by the panel of judges from Senegal, Mali and Togo is the first time Ecowas has been asked to rule on slavery. It is binding for all the organisation's 15 member nations.

Slavery was officially outlawed in Mauritania in 1981 but some human rights groups estimate up to 20% of the country's 3m people are still enslaved. A Malian human rights group, Temedt, estimated there were at least 7,000 slaves in just one region of the country, Gao.

Anti-Slavery International described how slaves in Niger were owned and completely controlled by their masters, receiving only minimal food and a place to sleep in return for their labour.

Speaking before today's judgment, Mani said: "It was very difficult to challenge my former master and to speak out when people see you as nothing more than a slave. But I knew that this was the only way to protect my child from suffering the same fate. Nobody deserves to be enslaved."

The life of a sadaka, or sexual slave, was described in detail by Mani during the court case. She explained how she had been born a slave, sold and then transferred as a child to a man against her mother's wishes. She testified that she was raped at 13 and constantly forced to have sex with her 63-year-old master, who owned seven other slaves.

In 2005, two years after Niger enacted a law forbidding slavery, Mani was presented with a liberation certificate. This proved to be worthless, as she was immediately forced into a "wahiya marriage", giving her the status of a concubine.

When she fled and married another man, her master had her arrested and charged with bigamy. She was imprisoned for two months on remand.

The issue has become deeply embarrassing for the government of Niger, which has failed to act on evidence of continued and widespread slavery in rural areas.