Hundreds of women in the United Arab Emirates (UAE) — including domestic workers who are victims of rape — are routinely imprisoned under laws that forbid sex outside marriage, a BBC investigation has found.

Under the UAE Penal Code, which is based on Sharia law, those convicted of zina (charges of illicit sex which include adultery, fornication, and homosexuality) face severe penalties. The law, according to the BBC, overwhelmingly affects the thousands of female migrant workers traveling from Asia and Africa to find work in the homes of the wealthy, brought in via the kafala system — where employers sponsor their employees' entry into the country.

The crime of zina is not confined just to the UAE, however. In a March 2012 report, Human Rights Watch (HRW) found that around 95 percent of girls and 50 percent of women jailed in Afghanistan were accused of the "moral crimes" of "running away" from home. HRW found that some women and girls were convicted of zina after being raped or forced into prostitution.

In September 2015, according to HRW, a photo of a young woman whipped in the Afghan province of Ghor came to light. It reportedly showed a 22-year-old woman named Zarmina, who was arrested with a 21-year-old man, both accused of zina.

Yet the testimonies collected during the BBC investigation reveal how women face the terrifying prospect of imprisonment in the UAE. One domestic worker — named as Monica — was raped by another servant in the household she worked for, and became pregnant. She pleaded with her "madam" to let her return to the Philippines, yet her request for help was turned down, with her madam relying on rights conferred under the kafala system: "Why should I send you home? You haven't finished your contract."

International outcry followed when Monica told her story to a popular radio show in the Philippines. She was subsequently allowed to go home — but in other cases, female migrant workers accused of zina remain trapped.

Secret footage, from January 2014, also obtained by the BBC shows a woman on trial in the UAE shackled in chains, accused of having sex outside marriage with a fellow Filipino.

The extent of the abuse is unknown. In 2014, another HRW report, which suggests that there are at least 146,000 female migrant domestic workers employed in the UAE, stated how some employers accused workers of zina "to counter rape or sexual assault allegations that the worker had made against the employer." Instances of hospital staff reporting domestic workers to the police after they seek medical help for miscarriages or pregnancy have instilled fear according to HRW, meaning the law discouraged workers reporting rape and sexual assault.

In its 2014 human rights report, the US State Department stated that cases of employers raping or sexually assaulting foreign domestic workers "rarely went to court, and those that did had a low conviction rate." The "extremely high burden of proof" for rape cases was a major factor.

"Additionally, female victims of rape or other sexual crimes faced the possibility of prosecution for consensual sex instead of receiving assistance from government authorities," it said.

A Norwegian woman, Marte Deborah Dalelv, was raped in Dubai. After reporting the attack to the police, she was subsequently charged with having extramarital sex. She received a 16-month sentence in 2013, before being pardoned later that year.