But in many places, judges are poorly educated — a majority do not have actual law degrees, and a significant percentage have not even finished high school — a situation that continues to exist, despite $904 million in “rule of law” funding from the United States alone between 2002 and 2010, much of it earmarked to improve the judiciary.

Under customary practices widely prevalent here, fathers have absolute power over their daughters until they marry, when such power passes to their husbands. They can marry girls off at birth, or at any age, with or without their permission, often making them bartered goods to solve family debts.

An often-invoked customary offense that does not exist in written Afghan law is that of running away from home. Even if the runaway girl is 18, legally an adult, courts still frequently impose a jail term of one year, based entirely on customary law. In fact, Afghanistan’s Elimination of Violence Against Women Act specifically forbids prosecuting runaways. “There is no such crime as running away from home,” said Shukria Khaliqi, a lawyer and legal program director at Women for Afghan Women, an aid group that runs women’s shelters. “In some cases the judges don’t even pay attention to Shariah law; they ignore that and they will say to the girl, ‘It’s not Europe or the West here, it’s not up to you, it doesn’t matter if you’re an adult or not.’ ”

Despite the problems with the courts, Ms. Khaliqi said it was possible, particularly in Kabul, where judges were better educated, to win cases like those of Zakia and Mohammad Ali. She has been in touch with them by telephone to persuade Zakia to let her take her case to court — which would mean she would have to return to a shelter while the case was decided.

Reached by telephone in their undisclosed hiding place, Mohammad Ali said the couple were unpersuaded. Zakia had already spent six months in a shelter in Bamian, with no legal relief. “No one takes the law seriously in this country,” he said.