NONGOMA, South Africa -- One week before, Nonhlanhla Mhkize had risen early, walked to her tribal chief's home, climbed a desolate hill and lain on a blanket for what leaders of her Zulu culture call an "inspection" of her genitals. Now the teenager glowed as she held up a document she had earned for the fourth year. It declared her a virgin.

"Here is my certificate!" Mhkize, an 18-year-old with magenta-streaked hair, said giddily.

Surrounding her were thousands of girls -- some barely school-age, most adolescents -- who had traveled to this windswept valley for an annual dance in honor of the Zulu king. Like Mhkize, all were bare-breasted and wearing traditional beaded skirts and necklaces. All were certified virgins, a requirement for participation.

In this rural Zulu stronghold on South Africa's eastern coast, it seemed of little matter that the Zulu custom of virginity testing, decried by gender and human rights activists, was banned for most girls in a bill passed by Parliament and enacted last year. Zulus here, who say it is a way to curb teenage pregnancy and AIDS, defiantly embrace the practice.

"There are changes and development in life, but that does not mean people have to change their culture," King Goodwill Zwelithini told the crowd, the fur tassels of his animal-skin cloak whipping in the wind.

The debate over virginity testing is an example of the clash common throughout Africa as governments try to regulate traditional practices that have long held sway, particularly in rural areas. Legal experts say the topic is particularly complex in post-apartheid South Africa, where patriarchal tribal cultures have dusted off long-stifled traditions under one of the world's most progressive constitutions, which lauds diversity but requires cultural customs to bend to individual rights.

South Africa has licensed traditional healers despite criticism that they are frauds, and it has legalized gay marriage over the protests of tribal leaders. This year, the nation's highest court recognized one woman's right to become the first female chief of her tribe, a decision condemned by some tribal leaders, while a bill that would regulate customary courts has stalled over disagreements about the role of women.

The virginity testing debate still simmers after a decade in the spotlight, despite the law prohibiting the testing of girls younger than 16. Elderly women typically perform the tests, often in front of the girls' parents, by inspecting their genitals for torn hymens. Most common among Zulus, South Africa's largest ethnic group, the practice is distinct from female genital mutilation, which was banned by the same law.

Among those who have backed virginity testing is Jacob Zuma, a Zulu politician who is expected to win the presidency next year. In a headline-grabbing appearance in 2004, Zuma -- who has several wives -- told girls attending a virginity testing program that, under African custom, their chastity was "their family's treasure."

South Africa's Commission for Gender Equality, which backed the ban, argued that girls were pressured to be tested, that the "public spectacle" of the procedure was degrading, and that girls who did not "pass" would be emotionally scarred, if not shunned. Girls who did pass, the commission argued, faced the cruel prospect of being raped in a culture in which some men believe that intercourse with a virgin can cure AIDS.

"The very notion of virginity testing as interpreted is that it's up to the girl to prove her virginity. . . . They are presumed to be the ones who are likely to be deviant," said Nomboniso Gasa, the commission's chair. "This practice, important as it may have been in the past, no longer serves our society."

Zulu proponents of the practice disagree strongly with that argument. The practice, they say, has never been more important in a country with one of the world's gravest AIDS epidemics. Virginity testing acts as a culturally sanctioned abstinence campaign, they say, preventing disease, unwanted pregnancy and even rape -- the identification of young girls who are not virgins, their theory goes, can detect child abusers in the community.

Critics, who note that the hymen can tear in many ways unrelated to sex, say no research backs up those arguments.

Nomagugu Ngobese, a sex educator in the provincial capital of Pietermaritzburg, said she has trained about 800 virginity testers. She said that testing is never forced and that most girls find it "uplifting." Contrary to what critics say, she said that there is also a virginity test for boys, though she declined to describe it.

"They must leave culture aside," Ngobese said. "Human rights are individual rights, which is not the way for us. We live communally."

To Ngobese and other supporters of the practice, the ban was evidence that Western mores were winning.

"They say the constitution does try to be all things for all people," said Phathekile Holomisa, president of the Congress of Traditional Leaders, a lobbying group. "But it also says those cultural practices must be subject to the bill of rights and the constitution. . . . The interpretation has so far been negative toward African cultural practices."

Yet the virginity testing ban is also an example of the limited power of law over culture. A spokesman for South Africa's social development department said that the ban's regulations were still being worked out but that violators could be subject to criminal charges.

But few, including Gasa, picture police raiding villages. If nothing else, she said, the law gives legal backing to girls who want to defy tradition.

On this blindingly sunny September day in Nongoma, thousands of girls strode toward the royal palace through parched hills dotted with thatched-roof huts. Each girl carried a reed as tall as a house as an offering to the king, who revived the annual reed dance -- an ancient Zulu celebration at which the king traditionally chose a bride from among the maidens -- in 1984. Custom held that if the reed broke, the girl was not a virgin.

Organized in groups by community, girls danced past the king and his entourage and sang Zulu-language songs tailored to the occasion.

"The king says there must be virginity testing," went one. "How? Virgins must lie on their backs, put up their legs and be tested. Look! Virgins, virgins, virgins."

In the flat plain below the palace, Thobeleni Ntuli, a stern woman with a cellphone stuffed in the bodice of her black beaded dress, said she had never heard of the ban. She said she began testing her daughters and now offers it as a public service to other girls, most of whom start at age 9.

"It is important so that young girls become scared of boys," said Ntuli, 45. "Because what happens is first the boy strips you of your virginity, and the next thing you know is you are pregnant and you have HIV."

Though the attire was traditional, modern South Africa was also on display. Some girls text-messaged as they danced past the king. Banners pitching cable service flapped near the large white tents where a speaker proclaimed that chastity is "a precious diamond in today's material world."

Nearby, Mhkize and three of her friends stood with their arms around each other's necks, which were encircled by white bead necklaces.

"Yes!" the girls, ages 14 to 18, said in unison, when asked if they liked virginity testing. They, like their elders, were adamant about the ban.

"They didn't come up with it," said Andile Mahaye, 16, a tall girl who aspires to be a movie director. "So why should they stop it?"

"It's like they're encouraging us to get pregnant," Mhkize said.

"It could just be that they don't give the Zulu culture dignity," Mahaye said.

But they hesitated when asked what it would mean, and what might happen, if their reeds had broken.