Seven or eight girls lounge on sofas in the basement lounge at the London Street Sauna in Edinburgh.

As we come in off the street they beam out a synchronised smile. Mostly they appear to be in their early twenties, healthy-looking, slender, some Thai, mostly dressed in black and startlingly pretty.

I feel I am trespassing. Visitors here are almost exclusively male – and there is a reason for that. The sauna and massage parlours of Edinburgh function, in an unofficial way, as licensed brothels. Punters here don't come for a back rub. They want, for the most part, some kind of sexual encounter. But a massage is what I say I am here for. By way of some sort of cover, I've taken along a seasoned patron of Edinburgh's massage parlours as my guide. He is posing as my partner.

The man at reception, a casually-dressed, well-built Scot, confused by our request, leads us through the dark-red labyrinth of rooms, past a large picture of a bared, female bottom, to a small office at the side. He asks us what we really want. "A massage?" I ask. "Can I just have a massage?" He tells me that if that's all I want then he's not going to waste the time of the girls: he might as well do it himself. Massages cost £30 a time here, but it's what you order on top, from the girls, that is where they make their money. My companion, Mike, asks for a "front massage". He has been here several times before. He recalls a parrot that used to sit in the corner. The man tells us that the parrot is gone. It fell ill and the vet bills got too much. One of the clients ended up adopting it.

This is not the only sauna that Mike has frequented. He is a man who has sampled many sectors of the sex trade and he has also visited other saunas, so he knows how they work. I wanted

to see inside one of Edinburgh's notorious massage parlours – not actually get a message, so of course, no deal was ever done.

These parlours operate in a strange demi-monde. On the face of it the capital is a place of the castle, of tourists, of the beautiful cultural face of Scotland, but behind this facade Edinburgh's vice world emerges. Mike describes the kind of thing that happens in these places. A punter is given a bath robe to wear and left to sit with the girls while they chose the one they want to have sex with. Then they go to a room. The man gets a massage and chooses from a "menu" of other services.

If you talk to anyone working in the sex industry, they will say there is a hierarchy to it. At the bottom are the girls on the street, living a riskier more precarious existence – often drug addicted, often coming from a life in care. Next rung up are the sauna workers, then the girls working from their own homes and flats, and at the top are escorts working for agencies. As one Edinburgh escort puts it: "Like other industries, the sex trade caters for all levels. You have your people who want to shop at Tesco and those that want to shop at Marks & Sparks."

A tangential side to the sex industry is lap dancers. Many girls who work as lap dancers detest the comparison because they do not exchange sex for cash – but inevitably some do.

Mike takes me to the Western Bar, where the dances are cheap, and the girls charge just £5 to gyrate for male eyes. The bar is filled with grey-haired men, talking to pretty, scantily clad young women. This, Mike says, is the "glamour" end of an industry but also a place where girls apprentice in the sex trade. In some bars girls pay a £100 deposit to dance, and out of their tips can make £400 on top of that a night.

We order a dance from two girls, J and M, and are taken to a room downstairs. I tell them I'm a journalist. J tells me she finds her job "empowering". She says the best thing she has got out of it is friendships. She and M say they aren't considering moving to any other part of the sex industry. What they like is the way the rules about touching are so strong here.

Visit any of these places and it's clear the sex trade is a young woman's game. Among the small population of older workers, is Suzy, an Edinburgh escort I find online. She is in her early 40s. "The older you are," she says, "the less business you get. Women from about 19 years old to 26 get the majority of the business. Most customers want the younger girl with the slimmer figure."

The policy of allowing saunas to get on with their trade in sex has been in place in Edinburgh for a long time. Brothel-keeping is illegal in Britain. But Edinburgh Council gives entertainment licenses for these venues, then tolerates the sexual activity that goes on. George Lewis of Scot-PEP, a charity that helps sex-workers, believes it has served the community well, increasing safety and bringing down levels of HIV. He would not like to see it change. "Not only would it impact on sex workers' sexual health, but also their physical health. It would force many women onto the street."

Another threat to saunas could come from MSP Rhoda Grant's proposed bill to criminalise the purchase of sex. Glasgow-based escort Laura Lee, right, is a strong voice objecting to this bill, which she says will leave the industry more dangerous. Lee believes, for instance, that criminalising the clients might lead to less reporting of coercion and trafficking. "The clients are the main people who see if women need help. If you criminalise the client, they're not going to report."

An advocate of "complete decriminalisation", Lee recently visited all the massage parlours in Edinburgh and talked to their girls. She recalls they were "very angry" when she put to them they were being "portrayed by Rhoda Grant as women that are coerced and pimped, or labouring under some sort of addiction."

In fact, Grant has not directly said this, though research accompanying her consultation highlights links between trafficking and drug use and prostitution.

SOME women in these saunas, Lee says, had been "working there for years, using it to put their kids through school and pay bills." Lee knows what it's like. Nearly 20 years ago, she started in a Dublin parlour, where she worked as a Saturday girl to fund her way through university. Many parlours may be owned or run by men but, she says, often it is women who set the tone. "Often the unofficial boss of the place is the head girl, the one that's been there for years. The head girl will do the monitoring. She'll keep an eye out for addictions or abuse."

"I know," she says, "from speaking to those women in Edinburgh saunas that if they felt another woman was there not of her own volition, got a whiff of coercion, or saw she was bruised, they wouldn't tolerate it. They would report it."

Most sex workers believe the risks of violence are far less in a decently run sauna than on the street, or even doing escort work. "You could," says Edinburgh escort, Suzy, "be going out to a house where there's more than one guy and you could be gang-raped." The answer, Suzy adds, is not closing down saunas or the further criminalisation of the trade, but the licensing of all sex workers. "The idea of closing down the industry," she says, "is ridiculous. You'll never close it down. As people say, it's the oldest profession in the world."