I’m walking through the security cordon that leads into Kadhimiyah, one of Shia Islam’s holiest sites. I’m in a queue, along with dozens of pilgrims who have come from all over the world to pay their respects to the shrine of Imam Kadhim. At the gate, a female security guard pats me down and looks into my handbag, a reminder that the story I’m reporting on here isn’t going to be easy.

As I walk around the market stalls surrounding the shrine, I notice the many “marriage offices” dotted around the mosque, which are licensed to perform Sharia marriages. I’d received tips that some clerics here were performing short-term mutaa [pleasure] marriages, a practice – illegal under Iraqi law – whereby a men can pay for a temporary wife, with the officiating cleric receiving a cut.

I was told that behind closed doors many of these clerics were using and abusing Sharia marriage laws to exploit women for profit. These men were grooming vulnerable girls and young women, trapping them into prostitution and pimping them out, all with seemingly total impunity.

For such a story, we needed to secure evidence on camera. We recruited a male undercover reporter who, over the course of our year-long investigation, met and secretly filmed several of the clerics running the Sharia marriage offices in the vicinity of the shrines. Meanwhile, I met and interviewed the clerics’ female victims, as well as some of the male clients who routinely used pleasure marriages.

First, our undercover reporter approached a number of clerics with marriage offices near the shrine of Kadamiya in Baghdad to gauge how many were willing to perform mutaa ceremonies. Out of 10 clerics that were approached, eight agreed to arrange a pleasure marriage for our reporter. “You can marry a girl for half an hour and as soon as it’s over, you can marry another,” one of the clerics, Sayyed Raad, told our reporter on camera, “even after half an hour, you can marry another,” he repeats.

We also caught on camera evidence supporting some of the victims’ claims that clerics often conspired with their male clients to deceive women. In a Kadamiya marriage office, our reporter, posing as a visiting businessman, was advised by the cleric to use deception when planning a pleasure marriage: “Take my advice, don’t tell her where my offices are in Kadamiya, so afterwards she can’t come looking for her rights. Trust me, it’s better that way.”

We found that teenage girls were particularly vulnerable to predatory men assisted by clerics, often paying the heaviest of prices for their misfortune. In Iraq, for a young girl to lose her virginity outside of marriage is widely seen as a scandal bringing shame on her family and tainting its honour. Such girls are often disowned and shunned by their families. In some cases, the girls are murdered.

In Kadamiya, Sayyed Raad offered to officiate a pleasure marriage between our reporter and “a young virgin”. He advised him not to take her virginity during their time together, adding that “anal sex is permitted”. “If I do take her virginity, God forbid, what do I do?” our reporter enquired. “Do [her family] know where you live?” Sayyed Raad asked. “No, they don’t,” our reporter confirmed. “Then you can just leave,” the cleric declared.

Reem alleged a cleric groomed her then sold her to three other men.

Watching the secret footage was difficult, especially as I was interviewing many young women who were living with the consequences of the clerics’ actions. One of them, Mona, was just 14 when an older man started following her home from school. “He told me he was rich, that he loved my personality, that I was beautiful.” A few weeks later, the man introduced her to a cleric and pressed her to enter into a pleasure marriage.

“I informed [the cleric] I was a virgin,” Mona told me, but the cleric didn’t ask for her parents’ consent, as is the custom in Iraq, saying it wasn’t needed as both she and the man were adults. Now 17, she is under pressure from her family to marry; but is terrified her future husband will find out she’s no longer a virgin. Her uncle, she tells me, killed her cousin merely for having a boyfriend. Now she keeps thinking about suicide. “I have no way out. If I feel more pressure, I will do it.”

The investigation took me to Karbala, Shia Islam’s holiest site. An important part of our investigation was to establish the role of the holy city’s religious authorities in all this – particularly whether they condoned the practice of pleasure marriages. At the main marriage office, I spoke to Sheikh Emad Alassady, who insisted the practice was illegal.

But around the corner from the office, we found another cleric who was willing to officiate a pleasure marriage to a child, including giving explicit instructions on how to sexually abuse children without getting caught.

This cleric was clearly not the only one taking part in such abuses. Another of the women I spoke to, “Reem”, accused prominent clerics of being involved in pimping and pleasure marriages. After Reem’s husband was killed by an Isis bomb in 2016, she and her two children became homeless.

Reem said that when she approached a well-known cleric for alms, he had sex with her and pimped her out to his friends. Reem doesn’t name the cleric, but describes him as powerful and well-known in her community.

“He proposed a pleasure marriage with me. I had to do it to survive,” she said. They would have sex once or twice a week in his office. Then he began bringing his friends, including one who, Reem says, was “famous in the region. He forced me to go into a room with this friend.”

Reem then found out the cleric was charging his associates three or four hundred dollars to have sex with her, while she was paid just pocket money. “They were like animals,” she told me. “They have sex with a woman then throw her away.”

But how are clerics able to get away with breaking the law so blatantly? The strength of the Shia religious establishment, backed by the intimidatory weight of armed Shia militias, appears to have given Shia clerics a sense of total impunity. Our investigation has found many of the clerics enjoy powerful political connections. One of them, Karbala-based Sayyed Salawi, boasted to our reporter that he was attached to a Shia militia, a claim which is given credence by photographic evidence we found on social media.

The BBC later approached the clerics for their response. Sayyed Raad denied he performed mutaa marriages. The others did not respond. Sayyed Raad had said he was a follower of Grand Ayatollah Ali Sistani, Iraq’s most influential Shia cleric.

The BBC approached Ayatollah Sistani’s office in the holy city of Najaf with the reporter’s evidence, and asked him to clarify his stance on mutaa marriages.

“If these practices are happening in the way you are saying then we condemn them unreservedly,” his office said. “Temporary marriage is not allowed as a tool to sell sex in a way that belittles the dignity and humanity of women.

“A guardian of a girl should not permit her marriage without her consent… and she is not supposed to marry if it’s against the law, which could bring troubles to her.”

Like some other Shia leaders in Iraq, the 89-year-old Ayatollah Sistani has previously – in a book published 25 years ago titled The Path of the Righteous – written that if a child under nine were promised in marriage or temporary marriage, sexual touching was religiously permitted.

The ayatollah’s office told the BBC times had changed and it had been erased from his current books.

This investigation showed how the hardships of post-conflict Iraq, and the rise of the Shia religious conservative establishment, have turned the clock back on women’s rights. Secular laws designed to protect women and children have been part of the Iraqi legal system for decades, but they have been rendered meaningless in the face of continuous flouting by powerful men backed by the country’s religious and political establishment. Meanwhile, a whole generation of young girls and women are paying a devastating price. As Reem put it, describing the clerics who abused her, “They eat the flesh, then throw away the bones.”

Nawal Al-Maghafi is a special correspondent for BBC News. Undercover with the Clerics: Iraq’s Secret Sex Trade is on the BBC iPlayer