Nujood complained repeatedly to her husband’s relatives and later to her own parents after the couple moved back to their house in Sana. But they said they could do nothing. To break a marriage would expose the family to shame. Finally, her uncle told her to go to court. On April 2, she said, she walked out of the house by herself and hailed a taxi.

It was the first time she had traveled anywhere alone, Nujood recalled, and she was frightened. On arriving at the courthouse, she was told the judge was busy, so she sat on a bench and waited. Suddenly he was standing over her, imposing in his dark robes. “You’re married?” he said, with shock in his voice.

Right away, he invited her to spend the night at his family’s house, she said, since court sessions were already over for the day. There, she spent hours watching television, something she had never known in her family’s slum apartment, which lacks even running water.

When Nujood’s case was called the next Sunday, the courtroom was crowded with reporters and photographers, alerted by her lawyer. Her father and husband were also there; the judge had jailed them the night before to ensure that they would appear in court. (Both were released the next day.) “Do you want a separation, or a permanent divorce?” the judge, Muhammad al-Qadhi, asked the girl, after hearing her testimony and that of her father and her husband.

“I want a permanent divorce,” she replied, without hesitation. The judge granted it.

Afterward, Ms. Nasser, the lawyer, took Nujood to a celebratory party at the offices of a local newspaper, where she was showered with dolls and other toys. Nujood lived with her uncle for a time after the ruling but then insisted on returning to her father’s house. “I have forgiven him,” she said. She swears she will never marry again, and she wants to become a human rights lawyer, like Ms. Nasser, or perhaps a journalist.

Despite the victory, Ms. Nasser and other advocates say they are worried about the lack of legal means to fight early marriage. Nujood’s case only reached the court because she took such a wildly unusual step and happened on a sympathetic judge.