On a sunny morning in Madrid, two young women duck down a side street, into a residential block and up to an apartment front door. Then they start knocking. Marcella and Maria spend a lot of time banging on doors and yelling through letterboxes all over the city. Most of the time, these doors never open. When they do, the two women could find themselves in trouble. Their job on the frontline of Spain’s fight against sex trafficking is a dangerous one; both have been assaulted and threatened. Yet they keep on knocking, because they have been on the other side of those doors, forced to sell their bodies for a handful of euros, dozens of times a day, seven days a week.

To say that prostitution is big business in Spain would be a gross understatement. The country has become known as the brothel of Europe, after a 2011 United Nations report cited Spain as the third biggest capital of prostitution in the world, behind Thailand and Puerto Rico. Although the Spanish Socialist party, which two weeks ago won another term in government, has promised to make it illegal to pay for sex, prostitution has boomed since it was decriminalised here in 1995. Recent estimates put revenue from Spain’s domestic sex trade at $26.5bn a year, with hundreds of licensed brothels and an estimated workforce of 300,000.

Supporters of decriminalisation claim it has brought benefits to those working in the trade, including making life safer for women. Yet this vastly profitable and largely unregulated market has also become infested with criminality, turning Spain into a global hub for human trafficking and sexual slavery.

Prostitution becomes sex trafficking when one person moves, detains or transports someone else for the purpose of profiting from their prostitution using fraud, force or coercion. In the UK, thousands of women are thought to be trapped in sexual servitude, but the scale of the problem in Spain is staggering. Until 2010, the law didn’t even recognise human trafficking as a crime. Now the Spanish government estimates that up to 90% of women working in prostitution could be victims of trafficking or under the control of a third party – such as a pimp – who is profiting from them. Between 2012-2016, security forces in Spain rescued 5,695 people from slavery but acknowledge that thousands more remain under the control of criminals.

Since it passed its first anti-trafficking laws in 2010, the government has been scrambling to get on top of this crisis, spending millions of euros on an emergency plan to target the individuals and gangs operating with impunity. In 2015, it went further and created formal alliances between security forces, prosecutors, judges and NGOs, to rescue victims and prosecute the perpetrators. Survivors such as Maria and Marcella now find themselves playing a crucial part in bringing the battle to the criminals who once sold and exploited them. But can Spain’s new alliance of defenders really turn the tide against the traffickers?

***

I meet Maria and Marcella, both in their mid-20s, in the offices of Apramp, an organisation set up to protect, reintegrate and assist women in prostitution. Apramp helped them escape their traffickers, and they are now among its outreach workers. Their day job is to identify potential trafficking victims and try to offer them a way out. They find women they think might need help on the streets, in hostess clubs, and in some of the 400 residences they say are operating as informal brothels in Madrid.

Maria, a trafficking survivor who helps others forced into prostitution. ‘You don’t have time to realise what has happened to you.’ Photograph: Ofelia de Pablo & Javier Zurita/The Guardian

Both shrug off the suggestion that they are brave. “When I’m wearing the Apramp vest at those apartments or on the streets, I don’t feel scared,” Marcella says. “We know from our own experience they’re doing much worse things to the girls and women inside. So it only makes us more determined.”

The two poised and eloquent young women, dressed like students in jeans and trainers, have lived through terrible things. Maria, petite and softly spoken, her brown hair pulled back in a ponytail, was brought to Spain from Romania by someone she trusted: she thought she was going on holiday with her new boyfriend. Instead, he drove her over the border using their EU residency cards and within 24 hours she was on the streets.

“It just happens so fast,” she says. “It’s difficult to describe how much you can be broken in such a short time. The shock and the trauma makes you go into survival mode. You don’t have time to realise what has happened to you.” She spent eight months being prostituted on street corners, in brothels and in strange apartments. “You’re alive but you’re not really existing,” she says. “Not one of the men who paid to sleep with me asked me if I was there out of choice, or whether I wanted to be doing this. They didn’t care either way.”

You can’t just stop a random person on the street and ask for help, because someone you love could get killed

She was told by her pimp that she would have to pay off a debt of €20,000 before she could go home. “With Romanian women, the traffickers threaten to kill your mother or your sister or your children if you don’t pay off your debt,” she says. “People always ask, ‘Why didn’t you just run away or go to the police?’ but they don’t know what they’re talking about. You can’t just stop a random person on the street and ask for help, because someone you love could get killed. The police in Romania are often corrupt. You think, why should it be different here?”

The promise of freedom in return for paying off the debt almost always turns out to be a lie. Maria says that, throughout her time under the control of the traffickers, she was hit with hundreds of tiny charges: she’d have to pay for clothes, rent for the corner she worked, for condoms and sanitary towels. If she didn’t bring back enough money, she wouldn’t eat or she’d be beaten.

“Debt is invisible,” Maria says. “It’s not a physical chain but it works the same way.” She says some traffickers force women to get breast implants and even though the operation costs around €3,000, tell them they have to pay back €10,000. Marcella nods in agreement. She was trafficked from her native Brazil after applying to do a master’s in Spain, a university course that turned out to be bogus. She was forced into prostitution immediately after she was collected from the airport. “If Apramp hadn’t found me, I think I’d be dead by now,” she says.

The fact that she not only survived but is now able to help others in the same situation has been an essential part of her recovery. “The mafia take you and destroy your whole identity. Even now, you’re recovering but you can never forget your past,” she says. “Doing this work really helps.”

From left: José Nieto, Spain’s leading anti-trafficking law enforcement officer, Rocío Mora, director of Apramp, which helps trafficked women, and prosecutor Beatriz Sánchez.

Between them, Maria and Marcella have helped dozens of women and girls escape their traffickers. It’s a process that takes months, sometimes years. Afterwards, Apramp finds the women somewhere safe to live, offers counselling and legal support, and helps them find work. “We have to show them that their lives are worth living again,” Marcella says.

Rocío Mora, Apramp’s co-founder and director, sweeps into the room and embraces Maria and Marcella, who are about to start their afternoon shift. “The only ones who really understand what we are facing are the survivors,” she says. Tall and immaculately groomed, Mora is one of Spain’s best-known anti-trafficking advocates; her rage at what she sees happening on the streets is raw and visceral. What Spain is facing, she says, is a huge violation of the fundamental rights of women and girls; anyone labouring under the impression that the majority of women working in prostitution in Spain are doing so by choice is deluding themselves. “The sex industry profits from the sale of women who are being controlled and exploited through debt, violence or psychological manipulation,” she says. “Our mobile unit has contact with 280 women a day and almost 100% are victims of exploitation and trafficking.”

A generation of young men believe they have the right to do anything to a woman’s body if they have paid for it

There are many reasons why Spain has become a hotspot, but for Mora, the biggest single factor is cultural. Spain’s sex trafficking epidemic is, she says, just the most extreme manifestation of the country’s problematic attitudes to women and sex. “There is huge demand for prostitution here. It’s become so normalised that it’s just seen like any other leisure activity.”

One survey in 2008 found that 78% of Spanish people consider prostitution an inevitability in modern society. And demand is huge: another survey, conducted in 2006, found that nearly 40% of Spanish men over the age of 18 had paid for sex at least once in their life. Mora has recently seen a radical change in the kind of men buying sex. Before, it was largely older men sneaking away from their families. Now, both the women on the streets and the sex buyers themselves are getting younger. “The social stigma isn’t the same as it was when I started out,” she says. “We have a generation of young men growing up believing they have the right to do anything to a woman’s body if they have paid for it, and they don’t have to worry about the consequences.”

As a young girl, Mora watched her mother (also called Rocío) start Apramp from their kitchen table. At 18, Mora was studying by day and driving a mobile health unit through Madrid’s red-light district by night.

A club in a high-end neighbourhood of Madrid.

“When my mother started this work, it was mainly getting health services to Spanish women who were engaged in prostitution to feed their families or a drug addiction,” she says. Two decades ago, criminal gangs started to take hold. “And it really was a radical change. There was suddenly a lot of violence and coercion – men on the streets watching the women and taking their money.”

Now, she says, most women in prostitution in Spain are foreigners: Apramp works with women of 53 different nationalities. “And the gangs are more sophisticated and more ruthless. They no longer need men on the street, because they are controlling the women through debt, fear and psychological control. This is what makes it much harder to fight, because many don’t see that they have a way out.”

***

On Calle Montera, one of Madrid’s busiest shopping streets, eastern European or South American women stand alone or in small groups. Maria and Marcella point out that many of the women they help don’t look like trafficking victims: it is easy for people to walk past them and not realise. Maria says many are also acting as human signposts, indicating that there are houses filled with other women nearby. When we get back to our car that evening, flyers have been stuck under our windscreen wipers offering a two-for-one deal on women for the special price of €30.

A short walk from Calle Montera is the HQ of the Centre of Intelligence and Risk Analysis, run by Spain’s national police. José Nieto is its chief inspector and Spain’s leading anti-trafficking law enforcement officer. As with Mora, anti-trafficking work has become Nieto’s vocation. He has spent more than 20 years trying to develop an effective police response to a human rights catastrophe that, until 2010, wasn’t even included in Spain’s criminal code.

“When I started in 1997, I was part of the brigade that believed all prostitutes did this work because they wanted to,” he says. “But it’s like an illness: at first you feel that something is wrong but you haven’t got a diagnosis. But as soon as you put a name to it, everything changes. You see it for what it really is.”

He explains the myriad reasons why Spain has become such a magnet for sex trafficking networks; “a perfect storm”, he calls it. “First, we are fighting a crime that is socially acceptable, because prostitution is accepted and embraced by many people here.” Second there is geography: “We are at the centre of all major migratory routes. The main victims we are seeing trafficked and forced into prostitution are Romanian, West African and South American. You can cross from Romania to Spain with an ID card. Africa is just 15km from us. We have a historic and a linguistic connection to South America.”

As in many countries, a prosecution is almost impossible without a victim willing to disclose their situation and testify against their exploiters. “There is great fear among victims that if they tell the police, they will be sent back to their countries with their debts unpaid,” Nieto says. “It makes policing very difficult; if the women don’t ask for help, there is a limit to what you can do. Here in Spain, prostitution itself isn’t illegal, running a brothel isn’t illegal, so you have to prove that what is going on is more than meets the eye.”

A sex worker takes a break in Colonia Marconi. ‘There is huge demand for prostitution here. It’s become so normalised.’

That evening, Nieto, the Guardian photographers and I join an undercover police unit conducting inspections of private clubs in Barrio de Salamanca, one of Madrid’s most high-end neighbourhoods. Although the police have all undertaken anti-trafficking training, their main job tonight seems to be restricted to checking ID and carting any woman found to be working illegally off to the police station.

At our first location there is a short period of confusion as our two unmarked cars drive up and down the street trying to find a parking space. By the time we enter, the music is already off and the club deserted – other than four women sitting silently on bar stools clutching their ID cards and a manager conspicuously cleaning glasses behind the bar. None of them is Spanish. The women all appear to be here on student visas, and shake their heads when the police chief asks them if they need help. There is no evidence that these women are victims of trafficking, but it seems ludicrous to expect anyone to disclose anything in this environment.

We’re making the traffickers understand that the Spanish police are something to fear

At other clubs, a few women who don’t have the right ID are loaded into a van. In one, three very young Chinese women sit silent and apparently terrified in their underwear on a cracked fake leather banquette, while police check the damp and dirty premises. A lone punter, a sweaty Spanish man in his 20s, is ejected from a bedroom at the back; outside another, a “sexy nurse” uniform hangs on a hook. The women keep their eyes fixed on the thickset Chinese man behind the bar as he chats easily to the police and shows them his licence. As we leave, the heavy metal door slams shut with a thud, leaving the women inside. One of the officers runs a hand over his face and exhales. “Dios mío,” he says. My God.

Yet Nieto believes there is hope and says the new strategy of creating formal alliances between police, prosecutors and frontline services is putting more pressure on criminal gangs. In particular, he cites coordination with Apramp’s Mora: “With her help, we’re making connections with survivors, we’re following the money and sending people away. We’re making the traffickers understand that the Spanish police are something to fear.”

Uniforms in a Chinese brothel. In Spain, prostitution isn’t illegal.

Nieto has been working with prosecutor Beatriz Sánchez for the past decade. Since 2010 the formidable Spanish lawyer has overseen more than 100 trafficking cases; in 2012, she succeeded in sending Ioan Clamparu, the “capo” of the biggest prostitution trafficking ring in Europe, to prison for 30 years. She is upbeat, funny and warm, but steely in her determination. “We’ve made huge advances in prosecuting and convicting human traffickers,” she says. “But many cases get dismissed or don’t go to trial.” Sánchez says only one-tenth of the trafficking cases she takes on make it to court because the burden of proof is high, requiring witness statements and months of police work. “Often cases are organised and transnational, involving the movement of huge amounts of money. They are complex crimes that are difficult to dismantle.” Under Spanish laws, you need proof of the use of extreme violence and intimidation to prosecute cases of pimping and coercion. “All forms of pimping need to be criminally punishable,” she says. “Only then can we effectively stop human trafficking.”

Sánchez says her natural optimism can be blunted by the uphill struggle to get cases to trial. “It would be hard if I was doing this alone, but the good thing is I have Rocío and José – we’re a team,” she says. “So when you are down and feel like things are hopeless, you have a reason to carry on. The others can pick you up and say: ‘Come on! We must keep going!’” Sánchez keeps in touch with all the women she represents. “Seeing them rebuild their lives is as satisfying as seeing their abusers go to prison,” she says.

***

We visit one of Sánchez’s former clients, Helena, at the offices of Proyecto Esperanza (Project Hope), the NGO that has supported her through her court case. Her family is from Ecuador but she was living on the outskirts of Madrid, with a Spanish passport, when she was forced into prostitution in her own neighbourhood five years ago, after falling victim to fraudsters who lent her money. They threatened to kill her small children if she didn’t work as a prostitute to pay it back. “When I was in that situation I didn’t see a way out, and the longer I did it, the more I died inside,” she says.

It took years, but in the end her traffickers were sent to prison and Helena was awarded landmark compensation of €100,000 by the state, €92,000 of which was estimated to be what her traffickers had earned from the sale of her body. She is yet to see any of this money, and her debts to family and neighbours remain unpaid. “I still owe €12,000 to friends and family from that time in my life, and I have no idea how to pay it,” she says. But for now she is surviving. Proyecto Esperanza is helping her find a job and providing counselling. She has a home and is rebuilding her relationship with her children. Despite her experiences, she is trying to teach them that the world can be a good place.

Helena praises Sánchez for giving her the courage to do this. “Beatriz was always so positive and strong at a time when I didn’t believe in myself at all,” she says softly. “Now I am trying to learn to love myself again. And that’s what I want to teach my kids – that no matter what other people do to you, it is important to love yourself and to look ahead. That in every terrible situation there can be a light at the end of the tunnel – a way out of the darkness.”

• Comments on this piece are premoderated to ensure the discussion remains on the topics raised by the article. Please be aware that there may be a short delay in comments appearing on the site.

If you would like a comment to be considered for inclusion on Weekend magazine’s letters page in print, please email weekend@theguardian.com, including your name and address (not for publication).