An Egyptian court has ordered a halt to forced virginity tests on female detainees in military prisons.
The case, which was decided on Tuesday, was filed by Samira Ibrahim, a woman who said the army forced her to undergo a virginity test in March after she was arrested during a protest in central Cairo's Tahrir Square.
Human-rights organisations say that there have been many other such tests by the military.
"The court orders that the execution of the procedure of virginity tests on girls inside military prisons be stopped,"
Judge Aly Fekry, head of the Cairo Administrative court, said.
Al Jazeera's Jamal Elshayyal, reporting from Cairo, said the verdict was cheered by hundreds of people who had gathered inside the courtroom to hear the ruling read out.
"Today's verdict to ban any form of virginity test [in military prisons] will be seen by many as vindication for their criticism of the military over the past few months," our correspondent said.
"This is something that will draw more criticism to the Supreme Council of Armed Forces - not so much the military itself, but its leadership."
Hossam Bahgat, the director of the Egyptian Initiative for Personal Rights who acted for Ibrahim, welcomed the ruling as "good news".
He said much work was still needed, however, to ensure the criminal accountability of those who ordered and conducted the tests.
A top army official had justified the examinations, saying there were necessary to head off possible charges of rape.
Responding to the verdict, the head of military intelligence, Adel Mursi, said the ruling was "inapplicable" because there are no instructions to conduct these tests.
"There are absolutely no orders to conduct virginity tests. If someone conducts a virginity test, then it is an individual act and that person will be subject to a criminal investigation," Mursi said.
On January 3, one soldier is to face court martial in the case of the so-called virginity tests, charged with "public indecency and not following orders".
"The way the case is presented gives the impression that it was one rogue soldier acting alone," Bahgat told the AFP news agency.
"For this, he could get away with just a fine. We are working very hard to have the charge changed to one of sexual
assault. We will fight to have a proper investigation carried out," Bahgat said.
In an emotional testimony posted on YouTube, Ibrahim, 25, recounted how she and other women were beaten, electrocuted and accused of being prostitutes.
She said the "virginity test" was conducted by a soldier in army fatigues in front of dozens of people.
"When I came out, I was destroyed physically, mentally and emotionally," she said.
On March 9, army officers violently cleared Cairo's Tahrir Square and held at least 18 women in detention.
Women said they were beaten, given electric shocks, subjected to strip searches while being photographed by male soldiers, then forced to submit to "virginity tests" and threatened with prostitution charges.
In May, an army general, speaking to CNN television on condition of anonymity, defended the practice.
"We didn't want them to say we had sexually assaulted or raped them, so we wanted to prove that they weren't virgins in the first place," he said.