A former American beauty queen who only left the US for the first time four years ago is perhaps an unlikely champion for change in the Afghan legal system.

But working as Afghanistan's only foreign defence lawyer, Kimberley Motley has helped both foreigners and Afghans trapped in the country's judicial system.

She took on one of last year's most high-profile cases, representing a woman named as Gulnaz, who had been jailed for adultery after she was raped by her cousin's husband.

That case led President Hamid Karzai to issue his first presidential pardon for a case defined as a "moral crime", a move seen by some as showing new commitment on the part of Afghan government to defend the rights of women.

As an outsider in the Afghan legal system, Motley feels she is in a unique position to get things done.

Image caption Ms Motley has also highlighted the plight of juveniles held in detention

"There were other Afghan lawyers who knew about the [Gulnaz] case who did not think it was a good idea to submit a pardon application," she says.

But Motley went ahead, and it worked.

She doesn't speak Pashto and uses an iPad app to translate tracts of Sharia law from the Koran. She argues with prosecutors through a group of specially trained legal translators.

Motley's bold approach - and her refusal to pay bribes - means she has met with plenty of opposition. She regularly receives anonymous emails threatening her with rape or death.

Gulnaz: Raped and jailed Raped by her cousin's husband in 2009, then charged with adultery

Initially sentenced to two years in jail, raised to 12 years on appeal

Gave birth to a daughter in jail

Kimberley Motley submitted a pardon application for Gulnaz

More than 5,000 people signed petition for her release

Pardoned by Afghan President Hamid Karzai on 2 December 2011

She credits her resilience to her unusual childhood in a rough part of northern Milwaukee, Wisconsin. Hers was the only mixed-race family in a neighbourhood divided along ethnic lines.

Her African-American father was serving in the US air force when he met her mother, a North Korean woman living in Seoul. They moved back to the US to start a family, but her father was seriously injured in a car accident at work after he left the military. His insurance company refused to pay out and the family went through hard times.

"People in my neighbourhood were often in and out of prison," Motley recalls. "Apart from mine, I don't remember anyone else having a two-parent household and there was a lot of drug-dealing."

But her parents instilled discipline and an entrepreneurial attitude in their four children.

Image caption Motley used beauty pageants partly as a platform to campaign on legal issues

The money she earned from a paper round and entering essay competitions went into the household coffers, helping to pay for private school and tutors. Later, her parents pushed her to study medicine, but the injustice of her father's insurance case inspired her to become a lawyer instead.

She worked as a public defence lawyer for eight years in the US, during which time she got married and had two children. Dared by a friend to take part in the Mrs Wisconsin beauty pageant, she won and went on to compete in Mrs America in 2004.

Four years later she went to Afghanistan with the US Department of State to help train local defence lawyers. It was the first time she had left the US and the system there was far from what she was used to.

"It was so unusually chaotic and it just made no sense to me at all," she says.

Countless problems beset Afghanistan's legal system. Nearly every day Motley says she sees the rights of defendants violated.

"This is the only place that I've seen where procedure trumps law," she says. "If the unwritten procedure says this is the way we do things, then that's how it's done."

Many defendants are denied access to lawyers and refused the chance to offer their own defence or even to speak in court, she says. She has seen people convicted on little or no evidence by overworked and under-resourced courts.

Motley's other work July 2010: Bill Shaw, senior manager at British security group G4S and former British Army officer, is acquitted of bribery charges on appeal

2010: Study of male juveniles in detention in Afghanistan found nearly two-thirds are physically abused after arrest

October 2011: Former Australian soldier Robert Langdon spared death penalty for murder of Afghan colleague (though she only briefly represented him) Source: Motley Legal

"In addition to that there was a lot of unfortunate corruption in the system," Motley says. "People would pay to get lesser sentences and it was pretty obvious."

The Afghan Ministry of Justice says it is carrying out wide-ranging reforms and has arrested hundreds of people involved in corruption.

"We have identified, dismissed and arrested around 60 judges in the capital Kabul and the provinces over the past two years," says the ministry's head of media, Abdul Wakil Omari.

Motley's first case was that of an African woman who had been arrested for drug smuggling. She took on the case after the woman's Afghan lawyer failed to show up in court, but the deadline for her appeal was already three months overdue and there was in fact nothing that Motley could do.

In Afghanistan a lot of the time women aren't treated as adults even though they are of adult age Kimberley Motley

"That really depressed me and also motivated me," she says.

Though she has a better understanding of the legal system now, she says her work has not got any easier.

As she has gained a reputation as a successful litigator, officials have begun to smother her in red tape, she says.

"I have to go through extra hoops that other people don't have to go through," she says.

"There is no good reason for opposition other than I'm being effective."

Motley says about a third of her workload is taken on free of charge, funded by money she earns from corporate clients.

Image caption Ms Motley is writing a book about her experiences in Afghanistan which will be published this year

But critics in Afghanistan accuse her of using cases like Gulnaz's to gain publicity, rather than protecting her client from the intrusive gaze of the media.

"I treated her like an adult woman," Motley says. "Here in Afghanistan, a lot of the time women aren't treated as adults even though they are of adult age.

"As her attorney I gave her the pros and cons and she chose to speak."

Motley is also criticised for choosing not to wear a headscarf.

It is an unusual - though not illegal - decision in Afghanistan, even among Western women. Initially she did cover her head but found it affected her performance in court.

"To do my job I need to be me," she says. "And being me is not wearing a headscarf."

Kimberley Motley spoke toOutlookfrom theBBC World Service.Listen to the programmehere.