Later she added, “You won’t be able to break me, military.”

State media reported that after the military court’s ruling, Ms. Ibrahim chanted for an end to military rule and then was rushed out of the courtroom. A video circulated online showed Ms. Ibrahim in tears after the trial. She has become an icon of the nascent women’s movement — which has found new freedom to organize since the overthrow of Hosni Mubarak last year — for pressing her case despite the stigma that has silenced most other women subjected to the tests.

Human rights advocates expected for weeks that the military court would acquit the doctor. Lawyers complained that they were prohibited from presenting evidence and witnesses, or trying to file charges against the officers who may have ordered the tests.

In the year since the episode occurred, top military officials sometimes denied but on other occasions acknowledged that military officers ordered the tests. Although human rights advocates consider the forced tests a form of sexual assault, military officials have reportedly said the tests were conducted to preclude accusations that soldiers had violated the women in their custody.

The civilian administrative court found that protecting soldiers from any possibility that they could be accused of wrongdoing did not justify subjecting women to humiliating and invasive procedures. The court banned the military from applying such tests in the future. Doctors also say that the tests are not medical and cannot ascertain previous sexual activity.

After the civilian court’s ruling, the military said the verdict was moot because such tests were not part of military policy. A council of generals took power after Mr. Mubarak’s exit, and they have pledged a transfer to civilian rule after presidential elections scheduled for June.