The trial, which ended on Monday, was the first in Iraq to specifically address the Islamic State’s crimes against the Yazidis — or at least one militant’s crimes. It was also the first in which a Yazidi victim personally confronted her attacker.

“I want my story to reach the whole world, so my message is heard by my friends and gives them the courage to do the same thing that I did, so that they can get revenge on Daesh,” she said, using the Arabic acronym for the Islamic State.

The chief judge in the case expressed a similar wish.

“We hope that if people hear about this case, others will come forward,” said Judge Haider Jalil Khalil of the Kharkh Criminal Court in Baghdad. He said the judiciary had been hampered in bringing this kind of case by the reluctance of victims to testify in public.

In Iraqi society, it is especially difficult for women to speak out in public about rape, as Ms. Haji Hamid did, for fear that they will be accused of having allowed the men to rape them and that they will tarnish their family name.

“But perhaps if they see that the judiciary will give them their rights, they will come forward now if they hear about this case,” Judge Khalil said.