I have retired to my local bar to leaf through the morning newspapers. Breakfast is served without any words being exchanged between myself and the waiter, beyond a brisk ‘buenos días’. He knows my order. It appears automatically, the clanking, bashing, steaming and sizzling of coffee machine and plancha, the hot plate used for frying and toasting, starting as soon as I am spotted walking through the door. This can be a complex business. How do you keep your fingers clean when the toasted roll you have been given has a large pool of olive oil washing over its crusty banks? And, once the oil is on your fingers, how do you stop it sticking the pages of your newspaper together? The little, square, tissue serviettes, grabbed from the plastic container on my table, pile up in front of me.

When it comes to sex surveys, I am used to turning to Cosmopolitan magazine or its glossy equivalents. Spain, however, has the august Instituto Nacional de Estadística, the state-run National Statistics Institute. So it is that, between sips of café con leche from a small glass that burns my finger-tips, I am informed that the instituto has discovered the following: more than one in four Spanish men under forty-nine have had sex with a prostitute during their lives, while one in seventeen have done so over the past year. ‘Both figures are noticeably higher than those observed in other surveys in Europe,’ the investigators comment. The instituto did not dare say it directly, but it was calling Spanish men the most enthusiastic brothel johns of Europe. Could that be true?

I looked around the bar, with its varnished, cork-tiled walls and strange 1970s decor. I wondered idly about the people here. Which of the men was a brothel regular? Could it be the blue-overalled painters and decorators renovating some apartment in our block? Was it the insurance-salesman type, frowning over his copy of El Mundo? Could it be the old man with the small moustache, leafing through the conservative ABC newspaper? Or would it be the chain-smoking ‘intellectual’, one eye on the National Geographic documentary showing on the television set perched high above the door, the other watching the nurses file in from hospital for breakfast? And what about the nurses, or the elderly, carefully made-up ladies who gather here to swap tales of ailments and operations while updating their oral births and deaths column on the barrio. Were their husbands, boyfriends, sons or brothers brothel-goers? Did they care? Did anybody? Should I? Did the instituto’s figures say anything about Spanish society? Or was this another bizarre, even prurient, subject that only an anglosajón would consider interesting? There was only one way to find out. It was time to let some neon into my life. I would have to visit one of those gaudily lit clubes de alterne, the brothels that dot Spain’s main highways.

Which is how I ended up at El Club Romaní, a huge, neon-lit pile of granite and slate – half French chateau, half Galician country pazo – in an industrial estate beside the motorway running south from Valencia. This was my first-ever visit to a brothel. I was trying hard to remember that the only way you could shock a certain type of Spaniard about sex was, well, by being shocked by it. So, as a young man in a black leather jacket and a friendly, wrinkled old doorman showed me around, I adopted what I hoped was a worldly, nonchalant personality.

I had spotted these clubs before. Who could miss them? Lit up with multi-coloured displays of neon, they shout their presence out loud. Newcomers wonder what these fanfares of pink, red, green and blue light that they see up and down Spain’s highways mean. Spaniards, however, know that much neon can mean only one thing.

I am not sure what I was expecting, but it certainly was not this. It was early afternoon and the club was still empty. We had wandered through the bar area and into a small corridor. A sliding door had been pushed aside and I was staring at a large, round bed covered with a bright yellow bedspread. Some colourful, crocheted cushions and stuffed scarlet love hearts were scattered on it. Circling the bed was a sort of padded crash bar. In fact, lined up below the erotic prints on the walls, there were a whole variety of bars and handles. Some were recognisable as the sort that elderly people put in beside their baths so they can haul themselves out of the water.

‘This is the room that has been adapted for discapacitados, for the disabled,’ announced the man in the black leather jacket, half-proud, half-amused. There was an en suite bathroom, with a ramp into the shower. The toilet had all the bars and extra bits a disabled person could hope for. But the pièce de résistance was sitting in the corner. ‘This is a very special wheelchair,’ black leather jacket, a former Moscow correspondent for a Spanish newspaper group turned PR man for brothel owners, explained. ‘You press a button and it stands itself, and whoever is in it, almost upright. That means they can go to the bar and have a drink too,’ he said, chuckling.

I was not sure whether to believe this. The room, I thought, must be a publicity stunt, something mocked up to win a bit of sympathy for his boss’s trade. But then the old man piped up. ‘In the old days we had to carry them upstairs to the bedrooms in our arms,’ he sighed. ‘It was hard work. It was pretty humiliating for them, too.’

What is interesting about Spanish brothels is not so much that they exist, but that they are so blatant. This, in turn, reflects Spanish attitudes to them, and to sex. Where anglosajones, for example, would be shocked, Spaniards are blithely indifferent. The instituto’s findings provoked no commentary – and no debate – in Spain. Newspapers reported, and then immediately forget about them. As an experiment in contrast, I ran the figures past a class of New York University students who I taught on a Masters’ course in Madrid. ‘Gross!’ came the unanimous reply from the front-row women. A wide ocean, clearly, separates one idea of sexual morality from another. In fact sex and morality are two words that a certain kind of Spaniard does not think should be uttered together, especially if other people’s sex lives and other people’s morality are being discussed. This did not mean Spaniards were wild sexual inventors. The American postgraduates would have won hands down on real experience if they had been compared to Spaniards of the same age. The instituto’s own figures confirmed that.

Before coming to the Club Romaní, the PR man had taken me to see José Luis, the lawyer for the brothel owners’ association that employed him, at the headquarters of his private security firm in Valencia. The lawyer had a Franco-era Spanish flag behind his desk. He was an ultra, a Spanish right-wing extremist.

Mariló, a Spanish prostitute, joined us. A single mother and former squatter, she was twenty-nine years old, cheerful and chatty. Mariló was introduced as the spokeswoman for a prostitutes’ lobby group, though it looked decidedly as if the group had really been formed by José Luis, who fed her lines. Mariló is, in fact, one of the minority of prostitutes in Spain, fewer than 5 per cent, who are actually Spanish.

‘What I really want is for people to stop looking down at me and treating me like a bolsa de basura, a rubbish-bag. It is time people recognised that we provide a social service,’ she said. Mariló was convinced of this last point. She adopted the professional lingo of the social worker to explain it. ‘We help get rid of depression and stress, and we help people communicate. Those are important things.’

The social-worker jargon slipped, however, when she mused on the only way to stop men going to prostitutes: ‘You would have to cut off their pililas, their little pricks.’

Mariló knew exactly why she was doing this. ‘It’s a way of getting money. Who else is going to pay my daughter’s nursery school?’ she asked. ‘I am not exploited. If anybody is exploited, it is the men. We exploit their sexual desires for money. And if anyone fails to show me respect in the bedroom, then they don’t get it. I am the one in charge.’ Occasionally, however, she expressed doubts about her career choice. ‘That’s because you lack self-esteem,’ José Luis told her. ‘Yes, it must be,’ she answered.

The association, José Luis wanted me to know, did not consider its members to be running burdeles, as brothels are properly called. It was called the National Association of Owners of ‘Alterne’ Places. He gave me a glossy magazine listing its members, places with names like S’candalo, Kiss Club, Falcon Crest and Hotel Elvis.

The clubs, he said, were places men went to alternar. The verb itself was a clue to the ambiguity with which the whole topic is treated in Spain. We struggled to come up with a definition. José Luis offered ‘trato y amistad’, ‘socialising and friendship’. It was such a uniquely Spanish word that I later looked it up in the dictionary of the Real Academia Española, which has the final word on the Spanish language. The Royal Academy, in a long-winded definition, said it was actually the women who were practising alterne as they ‘stimulate clients to spend money in their company, thereby obtaining a percentage’.

Whatever the exact definition, ‘alterne’, José Luis insisted, did not mean buying sex. Up to two-thirds of clients were only after a drink and a scantily clad woman to listen to their opinions, laugh at their jokes or make them feel attractive. ‘It is easy to calculate, because you may sell 1,200 tickets at the door – but only get 400 subidas – goings-up – to the rooms,’ said José Luis.

Mariló explained that the sex side of the game normally followed a heavily over-priced drink or two, for which she got a commission, and some chat. ‘I am told that in northern Europe things are much colder. The clients come in, point to a girl and they are off. Here, at least, you get a bit of conversation,’ she said. It somehow seemed very Spanish to put talking on a par with sex, even if both were paid for.

José Luis admitted that the confused nature of the law, which banned people from making money off prostitutes but did not make selling sex illegal, effectively allowed prostitution to flourish. Spain, he said, was probably the most permissive country in Europe (though Germany and Holland may dispute that). It even attracted sex tourists to clubs along its borders. ‘There is a lot of legal nebulosidad, haziness, and therefore there is great freedom … Prohibition would turn off the neon and bring in the mafias,’ he said. In fact, the mafias moved in long ago. Most of Spain’s more than 2,000 clubs are not members of José Luis’s association. An indeterminate number are in the hands of mafias and pimps who ‘own’ immigrant girls.

The association’s members had got around the law on not living off prostitution by only charging the girls ‘rent’ on the rooms they used. ‘These are hotels. They provide rooms for the girls, who work for themselves,’ Jose Luis said. ‘No laws are being broken.’

Reliable figures on Spanish prostitution are hard to come by. A Civil Guard report in 2004 counted 20,000 prostitutes working in clubs in a geographical area that contained 38 per cent of the Spanish population. It was, the same report said, twice as many as in 1999. José Luis claimed that alterne and the sex industry turned over 18 billion euros a year (and could, potentially, pay 3 billion euros in tax). That seemed a wild exaggeration. With just over a third of Spain covered by the Civil Guard report, however, and many prostitutes working the streets or out of city apartments, this is obviously a huge, and lucrative, business. And lots of people share in the bonanza.

A few hours later, after black leather jacket had scared the living daylights out of me in his powerful Audi, we were in Sollana, the small town that boasts El Romaní as one of its major businesses. This is where Valencia’s industrial suburbs meet the countryside. A Ford car factory, turning out Fiestas, Focuses and Kas, lies not far away. Around the corner, swallowed up by the industrial units, lies a tiny, well-cared-for, yellow-painted chapel dedicated to the Virgin of Aguavives. The industrial estate gives way to orchards of fruit trees that stretch out towards the old rice fields and wetlands of the Albufera, the large lake that runs up to the Mediterranean seashore.

In the car, the PR man told me of a minor-division football team from Albacete, which was saved from bankruptcy by shirt sponsorship from the Night Star, a local brothel. ‘One of the bonuses for not being relegated was a night at the club,’ he confided. Some alterne clubs were a key part of the local economy. One former health spa with a chapel for celebrating ‘weddings, christenings and first communions’ had become a club called ‘Madam’s’. It was said to contribute 30,000 euros a year in municipal taxes to the frontier town of Capmany, in Catalonia – enough to employ a road-sweeper or two. Some clubs in Galicia, he said, even managed to get local mayors to the openings.

The only legal problems the clubs got, he said, were raids from Labour Ministry inspectors. They shut the clubs down for a day or two and fined them up to 6,000 euros per girl. I never properly understood why. If alterne was a confusing word to define, then the laws that ruled it were, quite simply, crazy. On the one hand, it was illegal to make money off prostitutes. On the other, it was not illegal to have them working in your club. Then again, it was wrong, according to the Labour Ministry, not to give them proper work contracts. But giving them work contracts would, formally, mean making money off prostitutes. The law meant there was no straight answer to one of the questions I was asking myself. Was Spain formally in favour of (or, at least, not against) prostitution, or not? Perhaps, I thought, nobody wanted the question asked, or dared take a public stance on it.

My tour of El Romaní revealed just how big a business this was. On the upper floors there were huge, luxury suites with saunas and six-seater jacuzzis. There was a small, well-equipped gym for the 60 to 100 girls who lived here in shared rooms. In the attic I was shown a fully-equipped hairdressing salon and sun-bed. Downstairs there was a boutique selling, amongst other things, miniature bikinis and pairs of platform shoes with impossibly high heels. The prostitutes had their own canteen. A cork board informed them about medical tests and gave addresses of local Western Union branches, so they could send money home. Globalisation, I realised, was firmly entrenched in the Spanish sex trade. A global need for money met a local demand for sex.

The owner’s son, a young man whose expensive black leather jacket matched that of the PR man, showed me a file full of photocopies of the girls’ passports. They came from at least two dozen countries, stretching from Poland, Portugal and Paraguay to Lithuania, Nigeria or Brazil. ‘We send copies of their passports to the Guardia Civil,’ he explained. ‘That way they can check if any are false.’ The local police, in other words, far from being a threat, were punctually informed of exactly who was working at the club.

The owner’s son said the club filled up with eighteen- to twenty-five-year-olds on Saturday nights, some dropped by girlfriends who met them later at a nearby macro-discotheque. ‘There are things you just don’t believe until you see them,’ he said. Many prostitutes took Saturdays off. The youngsters were not big enough spenders for them.

An hour or so after my tour of the empty club we came back. Men were coming off shift, or finishing a day at the office. The car park was almost full, though the owner’s son insisted this was a quiet afternoon. He was still hopeful that the crews of three Nato frigates docked in Valencia – from Britain, the US and Italy – would show up. The bar was now packed with girls in micro-bikinis, tottering around on towering platforms with transparent, stacked heels. Some were already draped around clients at the bar. Others were leading men upstairs to the rooms.

¿Fumas?’, ‘Do you smoke?’ asked a Moroccan girl, apparently looking for a cigarette. ‘No, I’m afraid not,’ I replied. ‘¿Y follas?’, ‘Do you fuck then?’ she added.

After the initial shock, and the problem of where to rest your gaze, the inside of a club pretty soon turns mundane. The clients were an average cross-section of adult Spanish men or, at least, of those who could afford to drop twenty euros on a drink or anything from 60 to 600 on sex. Curiously, many really did look as though they were trying to chat up the girls – as if the credit card was not the key part of the deal.

What, I wondered, did the people of Sollana think of having El Romaní, that temple to commercial sex, in their backyard? In town I found another building with bright lights on the front. A figure of Christ decorates the front of the Santa María Magdalena church in the Plaça Major. It is surrounded, not with neon, but with a ring of clear light-bulbs. I found the priest in his parish house just behind the church. He opened the door, but did not invite me in. ‘Does anybody in Sollana ever complain about El Romaní?’ I asked.

‘Not really,’ he said. ‘Some people complain in private. But it is out of the way in the industrial estate.

‘Whoever goes, goes, and whoever does not, does not,’ he added, somewhat enigmatically. ‘La gente pasa. People can’t be bothered.’ The priest himself only went to the industrial estate to officiate at the fiestas for the Virgin of Aïgues Vives in August.

There is no sign of forced exploitation in El Romaní. But this is the high end of the sex market. Only eighty clubs belong to the association, with its rules about medical check-ups and telling police who is working in them. Catalonia, where local authorities have introduced a form of registration, has some 270 clubs. The vast majority, however, make up their own rules. Some have thugs on the door and debt-laden illegal immigrants working, in effect, as sex slaves. What, I wondered when I drove past it outside Toledo, would a club called ‘Cow Woman’ be like?

I was still perplexed. If it was illegal to make money out of prostitutes – even if it was not illegal to be, or go to, a prostitute – how could the clubs be so brash about their business? And, if prostitution really did turn over that much money, who was getting the cash? One obvious place where the money was going was to Spain’s major newspapers.

In my highly conservative neighbourhood of Madrid, a peculiarly shaped newspaper is stacked high every morning at the newsagents. Called ABC, it is little more than the size of a magazine. Old men with bottle-green woollen overcoats or Burberry macintoshes queue up at my local newspaper shop every morning to buy this, the voice of traditional, Roman Catholic Spain – though, I notice that, after a recent revamp, it is also gaining younger readers. Every Thursday a religious supplement, Alfa y Omega, gives voice to the concerns of the archbishopric of Madrid – including, for example, warnings about the dangers of gay marriage or single parenthood.

Flick through the pages of ABC, however, and you will find its readers are no strangers to prostitution. For here are several pages covered with hundreds of small advertisements from prostitutes. ‘Eva, 19. Upper-class girl from Salamanca neighbourhood, so insatiable that my parents threw me out of the house after catching me in bed with lots of boys. I am pure vicio, (vice). Now I live on my own … and can do all the guarraditas (dirty little things) I ever dreamed of,’ runs one. It is by no means the most explicit. All Spain’s ‘serious’ newspapers run advertisements like this. El País, El Mundo, La Vanguardia, El Periódico, El Correo … All the worthiest publications boast pages of advertisements that, in some newspapers, can be accompanied by photos of scantily clad women and descriptions of the world’s more bizarre sexual practices. The advertisements are placed by male, female and transvestite prostitutes. Like all established small-ads columns, they have their own argot. There are promises of sexual practices from across the world – Greece, Thailand, Japan, even Burma – in ‘private apartment, hotel or at your home’. Credit cards, some advertisements reassure readers, will be accepted. The Comisiones Obreras trade union claimed in 2005 that one newspaper, which it did not name, was gaining 6 million euros a year from these advertisements.

The contrast between a country which, when asked by pollsters, describes itself as 80 per cent Roman Catholic and its generally laissez-faire attitude to all things sexual is one of Spain’s great paradoxes. That contrast reaches its zenith in the pages of ABC and – lest you think that this is a last vestige of ‘old’ Spain – in its new, successful, even more conservative rival, La Razón. The Pope inspires the editorials but it is prostitutes who service the smallads pages. The left-wing and liberal press is, in a convenient combination of commercial and moral interests, laissez-faire on sex and, by extension, prostitution, almost as a matter of identity. Searching through the archives of the left-wing El País, for example, I find precious little room afforded to the kind of feminist thinking that says prostitution gives men the wrong idea about women.

Prostitution, then, is a sort of open secret. It is there for all to see, but is surrounded by either silence or indifference. Spanish friends, of both sexes, enjoyed my tales from El Romaní. Few made any comment, however, except to say that the disabled room sounded like a good idea. Most did not realise that Spain had far more, or at least far more visible, brothels than other places. Some agreed that prostitutes provided a social service. The contrast with my class-full of New York University students could not be greater. That is not to say that some Spaniards – mostly traditional, Catholic conservatives or feminists – do not want to get rid of prostitution, but they remain largely silent or unheard.

The problems with the anglosajones, several Spanish newspaper columnists had already informed me, was that too many of us were moralistas. Although the translation, ‘moralist’, often sounds harmless enough, in Spanish it brought connotations of extreme puritanism. Moralistas, they suggested, were moral fascists, out to control the private lives of others.

Spaniards seem genuinely unconcerned about sexual morality or, more accurately, other people’s sexual morality. A recent glut of open-to-air, late-night porn on local television channels – peppered with advertisements for chat lines – has been greeted with either jokes, or resounding silence. I once walked into a bar in a small Andalusian town to find it playing on the television set in the corner. The customers, male and female, continued their conversations as if it was just another bullfight or football match rather than a stew of naked, ejaculating bodies. Turning on the television while sitting up late one night working on this book in a small hotel in a lovingly restored old building in Granada’s Albaicín district, I was given my introduction to gay porn. Two men were mechanically sodomising one another on what appeared to be some local broadcaster. Are the conservative burghers of Granada, or any other city whose local television stations are, like the local newspaper, making money off prostitution or pornography, up in arms? Not at all. It is not just that nobody is, or is prepared to admit to being, scandalised. Sex, paid for or otherwise, just seems to be a matter-of-fact sort of business. Puritanism, it seems, really does belong to Europe’s north.

I was reminded of this by Alex Ollé, one of the directors of the avant-garde Catalan theatre group La Fura dels Baus, as we sat at a café table in the main square of the small Murcian farming town of Lorca. I had just sat through his play XXX at the town’s quaint, turn-of-the-century playhouse. La Fura have gained themselves an international reputation for sensorial bombardment, for getting in their public’s faces. XXX was no exception. It featured a live internet link to a Barcelona peep-show as well as simulated, or filmed, threesomes, foursomes, blow-jobs, cunnilingus, spaghetti sex, sodomy, rape, S&M, incest and, to finish it all off, genital mutilation. At one stage the play had invited me to contemplate the non-dilemma of whether pornography or war was more shocking, as if the two things were somehow comparable. More seriously, it was also an invitation to think about where the limits were. I had to close my eyes for most of the last five minutes, the rape and mutilation scene, so my personal answer was obviously somewhere before that. But none of the dapper elderly gents or fierce-looking matrons, fresh from the hairdressers for their night out at the theatre, appeared, at least on the surface, terribly disturbed. Certainly none accepted the invitation to leave if they felt shocked.

‘This show would cause a scandal in a small British town,’ said Ollé, accurately predicting what would happened when it travelled to a London stage a year later. ‘The British are very conservative. When it comes to sex, there is not too much prejudice here in Spain.’

I am not sure, however, whether he was completely right. There still seems to be something very male-centred and, one young Madrileña woman suggested to me, slightly seedy about this attitude. Certainly, she assured me, young men still had different ideas about what was acceptable sexual behaviour for them and what was acceptable for young women. That form of prejudice at least had not disappeared.

Only a handful of voices on the Catholic, conservative right or the feminist left seem to get worked up about prostitution or pornography. Shortly after I had visited El Romaní, I came across a long report in El País newspaper on the country’s status as Europe’s largest consumer of cocaine. A psychiatrist suggested that one reason for that was that a defining trait of modern Spaniards was that they were radically opposed to banning anything. ‘Anything that smacks of restriction or prohibition in this country is considered immoral, old-fashioned and fascist,’ the psychologist, Carlos Alvarez Vara, said. Spaniards, in short, do not like being told what not to do.

To be scandalised about sex is to be ‘estrecho’, ‘narrow’ or prudish – something associated with the repressive, and hypocritical, time under General Franco when the Church really did set the rules. His death set Spain on a delayed sexual revolution that was grasped with fervour. But it would be wrong to blame all this on el Caudillo. Too many years have gone by. The pendulum has had plenty of time to swing the other way.

One measure of Spaniards’ attitudes to the rules that govern sex is the age of consent. This was raised from twelve to thirteen in 1999 by Aznar’s government. Other European countries place that age at anywhere between fourteen and seventeen. In the US it goes as high as eighteen in some states. Only a handful of countries – mostly Latin American or African – have a similar, or lower, age. In practice, however, Spaniards start their sex lives later than in other European countries. Most young Spanish men remain virgins until after their eighteenth birthday while most women wait until they are nineteen.

There can be a brisk, often amused, frankness in the way Spaniards discuss sex. On several occasions I have been caught out, and thrown into tongue-tied episodes of embarrassment, by sudden, graphic confessions of peccadilloes or amatory experiments. What, after all, do you say to a neighbour who apologises for not answering his doorbell because he was ‘snogging the babysitter’ while his wife was out? This attitude is reflected on television. One advertisement, for a chocolate bar, starts, as a joke, with a young man waking up with a tent-pole-sized erection in his boxer shorts.

This sexual frankness, apart from being ever-present in the films of Pedro Almodóvar and others, is also evident in the literary world. Most bookshops can be counted on to stock a few of the mauve-spined works put out by Tusquets publishing company in the Sonrisa Vertical – the Vertical Smile – collection of erotic writing. The Vertical Smile has been one of Spain’s most popular literary prizes (and there are almost 3,000 of these each year), though it has recently suffered from a paucity of entries. Nobel prize-winner Camilo José Cela once sat on the jury. The contrast with Britain, where it is a prize for bad sex writing that gets all the attention, could not be greater. Some of Spain’s best contemporary writers, including Almudena Grandes and her The Ages of Lulu – later translated into twenty languages – have walked off with the 20,000-euro prize. The jury praised one winner for ‘the richness of scenes that, aside from being fresh, turn out to be perverse, fetishistic and transgressive’.

All this frankness and unshockability might make one think that Spaniards were avid sexual adventurers, leaping from bed to bed and experimenting with every single possible sexual variety like characters from an Almodóvar film. But the Instituto Nacional de Estadística, with its Cosmopolitan hat on again, says that is not true. Half the women under forty-nine that it surveyed, and a quarter of the men, had been to bed with just one person.

A survey carried out in the mid-1990s by government-funded investigators at the Centre for Sociological Research found that only 41 per cent of Spaniards aged between eighteen and twenty-four had initiated their sex lives in a bed. With most still living at their parents’ homes, the others had resorted to cars, the great outdoors or anywhere else they could find a moment of privacy. ‘Parents are confused and out of touch. Most are convinced that their children do not have a sex life,’ a sociologist quoted by one newspaper explained.

This problem has led to some ingenious suggestions from local politicians. The southern seaside town of Vélez-Málaga, for example, considered turning off the seafront lights for an hour every night so couples could ‘release their sexual desires’. ‘It has always been traditional for young people to use the dark and the low tide for a roll in the sand,’ a town councillor explained. Granada’s Green Party, meanwhile, suggested handing out a hotel voucher, called a bonosex, to young people living at home. In the regional government of Extremadura, one functionary proposed setting aside ‘sex zones’ for young couples. None of these suggestions prospered. The last one was slapped down by Juan Carlos Rodríguez Ibarra, the Socialist regional premier. ‘I am not about to turn the regional government into some sort of madame,’ he snorted. ‘They will just have to find somewhere themselves.’ They do.

In the elegant, if crumbling, Madrid apartment block where I lived before buying my own flat, I was given a great lesson in Spanish sex education over the decades. I had been called to a tenants’ meeting which was to be held around the marble coffee table of Doña Rafaela, a smart and exquisitely mannered seventy-year-old who lived on the fourth floor. A rebellion had broken out against our landlord, who also lived in the building. At the appointed hour I crept furtively down the darkened staircase and rapped on Doña Rafaela’s door. She ushered me into a neat drawing room where half a dozen grey-haired ladies sat waiting expectantly. ‘¡Dios mío, it’s a man!’ one exclaimed. With the exception of our landlord, they pointed out, I was the only adult male in a building where most people had lived for more than thirty years. Many were still paying minuscule rents, frozen, if index-linked, back then. We, relatively recent arrivals, were paying twenty times more than some of the others. As the building gave him so little income, the landlord refused to invest in it. So it was that chunks of masonry were falling off the front of the building – requiring the fire brigade to cordon off the street one day – while the stairwell ceiling had also come crashing down.

I knew most of these señoras by sight, of course. Pleasantries had been exchanged at the doorway. Our two small children had been admired. One had even been presented with a bright yellow plastic cosh by Doña Adelaida from the second floor. But our short, shared trips in the groaning wood-and-glass lift had left time for little more than this.

It would have been rude to get straight down to business, so we chatted. Unexpectedly, the conversation turned to sex. The subject was brought up by Raquel, a chain-smoking granny-of-two from the first floor, who burst into the room clutching two bottles of wine and a box of books.

Raquel had just written The Address Book of Lost Friends, a publishing success which told of her daughter’s heroin addiction and subsequent death from AIDS. It is a startling tale of degradation amongst the niños bien, the rich kids, of the haughty Madrid barrio of Salamanca, in the dizzying first decade of the transition to democracy. Raquel had been at the journalistic forefront of the Transición, logging the amazing self-transformation of the Spanish parliament. While she worked, and drank, her daughter – a frightening, siren-like Lolita – descended into heroin addiction. She pulled cousins, friends and other neighbourhood kids along with her. Most were long dead. Two young grandsons, and the deep lines scoured on Raquel’s face, were all she left behind.

The grandsons were handsome young teenagers who, in an attempt not to repeat mistakes, had been sent to the local church school. Raquel was worried about AIDS. She had been trying to explain the importance of condoms to the eldest grandson, she said, but he had cut her short. ‘They think they know it all because they get sex education at school,’ she sighed.

‘Well, thank God they get that,’ snorted Doña Adelaida, a no-nonsense, Miss Marple figure with sensibly cropped grey hair. ‘I remember when my professor of natural sciences at the university announced that our next lecture would be on human reproduction. “So there will be no need for the young ladies to come,” he told us!’

‘Oh, there was none of that silly stuff when I was a student,’ remarked Doña Rafaela. ‘We heard it all.’

‘That, Rafaela, is because you went to university before me, during the Republic. I had to put up with Franco!’ snorted Doña Adelaida, now a university professor herself.

The arrival of Franco’s regime was one giant step backwards in social progress. Brothels survived, even thrived in the barrios chinos, the red-light districts in the old city centres.

Elsewhere, however, Franco set about abolishing the Republic’s liberal rules. Divorce was abolished, except where permitted by the Church. Civil weddings were only allowed between two non-Catholics. Abortion, of course, was illegal. A Supreme Court Prosecutor’s Office report in 1974, however, put the number of abortions at the amazingly high rate of 300,000 a year, or 40 per cent of live births.

Franco’s new Civil Code ordered that: ‘A man must protect his wife, and she must obey her husband.’ A husband’s permission was needed for women to sign all sorts of legal documents. Under this permiso marital system, she could not take a job or open a bank account without his go-ahead. Adultery by a wife was always a crime. Adultery by a husband was only one if it happened in the family home, if he lived with his mistress or if it was public knowledge.

‘When you are married, you must never confront him, never use your anger against his anger, or your stubbornness against his. When he gets angry, you will shut up; when he shouts, lower your head without reply; when he demands, you will cede, unless your Christian conscience prevents you … To love is to endure,’ a Church guide advised brides-to-be.

Old ideas of honour, shame, virginity and jealousy, some still deeply rooted in rural Spain, were dusted off and given a fresh shine. These were, anyway, enough to allow British anthropologists such as Julian Pitt-Rivers (in the mid-1950s) to evolve theories on the importance of honour, shame or grace in Mediterranean societies that were required reading on my social anthropology course at Oxford University. Change was slow. By the end of the regime, supposedly risqué films were made in which, according to the writer Rafael Torres, ‘a fat, ugly, stupid Spanish man would be pursued by beautiful half-naked women simply because he was a macho español, a breed of man supposedly much valued by Scandinavians and, in fact, by most women in the world.’

The worst thing, however, was that, as Torres puts it: ‘Women disappeared from the scene, except as passive objects. Machismo was radicalized.’ This meant women were not allowed to flaunt themselves, but men could harry them as they walked down the street. José Ortega y Gasset coined the phrase ‘violación visual’, ‘visual rape’. ‘Piropos’, words of ‘flattery’ shouted at girls as they walked down the street, reached their zenith. These are dying out. At their worst, they were straightforwardly crude. At their best, however, they could be highly amusing. My favourite, brought off the street by a Madrileña friend, remains: ‘Pisa fuerte niña, que paga el ayuntamiento’. ‘Tread firmly, niña, the town council’s paying [for the paving stones]!’

The Church became, once more, one of the major powers in the land and a constant chaperone for Spaniards’ private lives. In 1958 the Bishops’ Conference’s Committee on Morality and Orthodoxy warned that unmarried couples who promenaded arm-in-arm were placing themselves in peligro grave, grave danger.

In 1963 the Boletín Oficial de España published rules for film-makers which prohibited, amongst other things, ‘the justification of divorce, adultery or anything that attacks the institution of marriage or the family’. Criticism of the Church’s ‘dogma, morality or worship’ was banned in the same order, as was anything that provoked ‘low passions’ or was ‘lascivious, brutal, gross or morbid’.

Film censors committed some celebrated faux pas, including turning two of the protagonists of John Ford’s Mogambo, Grace Kelly and Donald Sinden, from husband and wife into brother and sister. An attempt to stop Kelly’s on-screen affair with Clark Gable becoming adultery thus saw her marriage turned into incest. Even the political censorship reached moments of sublime stupidity. Bogart’s lines about the Spanish Republic were expunged from Casablanca while, in Robert Aldrich’s Dirty Dozen, a no-good character called Franko was renamed, because his name sounded too much like that of el Caudillo.

Sometimes it was the censors themselves who inflamed imaginations. Spaniards imagined, for example, that in Gilda, Rita Hayworth did not just peel off her long glove to the tune of ‘Put the Blame on Mame’, but stripped for the cameras completely – and that this sight had been denied them by the censor’s scissors. An obscure German documentary, Helga, became a surprise hit when put on show at one of the Arte y Ensayo, art-house, cinemas that were opened in the later, more liberal, days of the regime. Extra showings were required to cope with those desperate to see a heavily censored film on sexual education.

The back rows of cinemas, the darker corners of parks and the doorways of streets such as Madrid’s Calle Echegaray, meanwhile, were the working places of women known as pajilleras, literally masturbators. They came equipped with a handkerchief and a vigorous wrist action. Some, according to Rafael Torres, would, for a little extra, sing a jota, a traditional folk-dancing song, while they performed their task.

If women’s sexuality scared Franco, his regime’s views on homosexuality were wholly predictable. Browsing through my local second-hand bookstore, I found myself confronted by a book entitled Sodomitas. It was a 1956 tome, which put homosexuality into the same bag of ‘enemies of the state’ as Marxism, freemasonry and Judaism. ‘This book was written to demonstrate the danger that the sodomite poses to the Patria, the fatherland,’ its author, one M. Carlavilla, proclaimed. ‘The herd of sodomite wild beasts, thousands strong, has invaded the busy streets looking for its young prey … Your son may return home, corrupted, hiding his shameful secret.

‘There is an undoubted affinity between the sodomite and the communist, both being aberrations against the family,’ Carlavilla added, before launching into a 300-page investigation of the subject.

Homosexuals were a threat to the regime’s ideal of a virile Spain. ‘Any effeminate or introvert who insults the movement will be killed like a dog,’ General Queipo de Llano once threatened. Introversion, it seems, was a thoroughly unmanly, un-Spanish, suspicious attribute. When the country’s greatest twentieth-century poet and playwright, Federico García Lorca, was shot by a Falangist death squad in the hills outside Granada, one of his assassins later boasted that he had ‘shot him twice in the arse for being a poof ’.

Thousands of homosexuals were jailed, put in camps or locked up in mental institutions. Prison terms of up to three years were imposed under laws covering ‘public scandal’ or ‘social danger’. Homosexuals were packed off to mental hospitals where some were given electric shock treatment.

Even, then, however, an underlying seam of social tolerance appeared to co-exist with the regime’s homophobic rantings. As always, the gap between the rules and what people actually did was huge. Aristocratic and pro-regime gays carried on pretty much as normal, with some even recalling the Franco period as a glorious time of illicit sexual encounters, according to one historian, Pablo Fuentes. Young men, some barely more than boys, who had come to Madrid to escape hunger or seek adventure would gather around the Las Ventas bull-ring. Many dreamt of becoming matadors, but ended up selling their bodies as chaperos, rent boys, instead.

For those who fell foul of the regime’s laws, life was hell. Antonio was sent to prison at seventeen in the early 1970s after he told his mother that he was gay. She asked a nun for advice. ‘The nun went straight to the police and I was arrested and sent for trial,’ he told me. ‘I spent three months in prison. I was raped there and in the police cells.’

When Franco died, however, there was no immediate change. In fact, when thousands of political and other prisoners, including terrorists, were pardoned the year after Franco’s death, homosexuals were left to serve out their sentences. They could still be jailed until 1979.

In the late 1990s, when stopped by police officers who checked his identity with the precinct, Antonio discovered that his homosexuality was still registered on a police file. ‘Watch out, that one’s queer,’ one of the police officers said. It was not until 2001 that Spain’s parliament finally pledged to erase the criminal records of gays locked up by Franco’s regime. But Spain, as ever, changes quickly. A police officer stopping a man wandering around Madrid’s ‘pink’ barrio of Chueca today would probably expect his victim to be gay. He might, in fact, be openly gay himself.

When Spain changed governments in 2004, one of the first things the incoming Socialists of Prime Minister José Luis Rodríguez Zapatero did was to stick to a pledge to give equal rights to gays and transvestites. Spain, suddenly, became the third country in the world to introduce gay marriage – after traditionally liberal Holland and Belgium. The government had done its homework. More than 60 per cent of Spaniards were actively in favour of gay marriage. They were, in fact, more tolerant about it than, say, Swedes. That did not stop the church bringing half a million demonstrators onto Madrid’s streets to complain about it.

At heart, most Spaniards are highly tolerant of the sexual choices of others. Even before the new gay marriage law, the Civil Guard, that symbol of Francoist repression, had begun allowing gay officers to cohabit in its barracks.

I decided to test just how deep Spanish tolerance was by going to Villalba, a traditional, conservative town in Galicia, on the day Zapatero’s government announced it would legalise gay marriage. This country town of just 15,000 was the birthplace of Manuel Fraga, founder of the People’s Party and, at the time, premier of the Galician regional government. He had been known to declare that those favouring gay marriage were ‘vandals’ and ‘anarchists’ who were ‘seeking to destroy the family’. It was also the home town of Cardinal Antonio María Rouco Varela, Spain’s senior bishop, whose officials had warned that it was ‘a virus in society’. I had expected the town, dotted with granite cruceiro crosses and signs pointing pilgrims along the Way of St James, to be foaming at the mouth with indignation. But the People’s Party deputy mayor, a country vet, said local farmers were beyond surprise. ‘Different sexual expressions have always existed in the countryside. People have always known that,’ he said. ‘There have always been priests in these parts with children, too. Nothing shocks people around here.’

At dinner that same night in a classy Santiago de Compostela restaurant, a senior, if urban, executive of a Spanish company seriously suggested that, when thinking about sexuality in the countryside, one should not forget a farmer’s relationship with his livestock. More pertinently, a gay activist in Santiago pointed out that Spanish homosexuals had no need to hide or close themselves in. ‘Spain has always been more open. That is why we do not have gay ghettoes like you get in Britain or other countries,’ he said.

As Franco headed for his deathbed, Spaniards began to party. When he died, they, or some of them, went wild. It was, according to Rafael Torres, a question of ‘a mass negation of what had come before, without concession to shame, to feelings or to intelligence.

‘Given that hunger is resolved by eating a lot, not by sampling small rations of delicacies, Spanish society tried to rid itself of its starvation with an uncontrolled, if inevitable, sexual revolution, which tore down the whole absurd edifice of repression and censorship,’ he explains. ‘But, just as happened in politics, there never was a true revolution of the affairs of the heart … The long, interminable Franco years left behind them a wilderness, a land sown with salt, a space that has simply been burnt out.’

It was an exciting time, and one of dizzying choices. Carmen Maura, the actress who was Pedro Almodóvar’s first muse, described it to me this way. ‘These were the silly questions of the time: Do I want sex, or don’t I? If I don’t, does that mean I am not moderna? Am I political, or aren’t I? Right or left? You might suddenly find yourself trying to learn the words to “The International”, because the following day there was a political meeting.’ It was an atmosphere reflected in film director Fernando Colomo’s 1977 Paper Tigers, which starred Maura.

When Franco died, the Roman Catholic Church finally lost its grip on Spain. Some priests had supported the illegal democratic opposition, spawning a group of revolutionary ‘worker priests’, otherwise known as the curas rojos. These had gone to work on building sites and in factories. A special priests’ prison had, in fact, been opened in Zamora. A 1973 police report catalogues 10.6 per cent (exactly!) of the country’s 23,971 parish priests as activistas. Some bishops had also pressed for reform, but many Spaniards had, with reason, come to think of the Church and Francoism as one thing. Was his doctrine not called, after all, National Catholicism? Franco had signed a concordat with the Vatican that gave the Spanish church money, censorship rights and media powers – but gave him power over the appointment of bishops.

Spain is, formally, now a secular state. Despite this, however, the Church’s claws are still sunk into government. When I fill out my annual tax returns I, along with all tax-paying Spaniards, am invited to tick a box saying that I want to contribute a small part of my taxes to the Roman Catholic Church. Some 40 per cent of Spaniards do, while a similar number mark a box giving to charities. In fact, the state continues to subsidise the Church, making sure it receives a fixed sum every year, regardless of how many people ‘volunteer’ to help it out with their taxes. A ‘temporary’ agreement signed in 1979 was meant to end in 1985 when the Church would become self-financing. It is still in place. Taxpayers, including non-Catholics such as myself, thus pay out 140 million euros extra each year to pay priests’ salaries. One estimate puts the amount of public funding received by the church at almost one-third of its total spending.

The Church also controls many private schools and, in the State sector, appoints the country’s 13,000 religion teachers. It requires them to impart ‘proper doctrine’ and bear ‘testimony of Christian life’. It can, and does, sack them on ‘moral or religious grounds’. Examples included sackings for marrying a divorcee, going on strike or refusing to pay part of their salary back into a ‘voluntary’ Church fund.

It is difficult to tell how religious Spaniards really are. One recent poll saw more than 80 per cent say they were Catholics, while 48 per cent admitted to being ‘practising’ Catholics. The proportion of Spaniards who define themselves as religious is, according to a different poll, no different to the proportion of Germans or Dutch who do so. It is significantly smaller than their southern Catholic neighbours in Portugal or Italy. Only the British and French consider themselves less religious. In fact, the Franco period now looks more like a last-gasp attempt at hanging on to already waning Church powers.

Strong, anti-religious sentiments of anticlericalismo also existed. These reached their violent zenith with the church-burning and priest-killing of the Civil War. Hatred of a powerful Church, however, went back much further. Barcelona’s so-called Semana Trágica, Tragic Week, in 1909, saw plumes of smoke dotting the city horizon as church after church was set alight. This mirrored similar episodes from earlier in the century. ‘Destroy its temples, tear aside the veil of novices and elevate them to the category of mothers,’ the populist demagogue Alejandro Lerroux had urged.

In 1835 a progressive liberal, Juan Mendizábal, came to power. He confiscated much of the Church’s landed property, selling it off at auction. The liberals’ enemies, a group of conservative catholics known as the Carlists, not only supported a rival dynastic line for the Crown but also rallied to the battle cry of ‘the church in Danger’.

While the bishops huff and puff, the gulf between the Vatican’s teachings and what Spaniards do continues to widen. Rebellion, meanwhile, has also come from within. Spain boasts the Roman Catholic church’s first avowedly gay and sexually active priest, Father José Mantero. I met Father Mantero at the offices of a glossy gay Spanish magazine, Zero, on whose front cover he had proclaimed that, ‘Being gay is a gift from God.’ Father Mantero, from the southern town of Valverde del Camino, was a thirty-nine-year-old bearded man with a silver earring. ‘The Church says we must have compassion for homosexuals, which means it thinks there is something wrong with us. For many gay priests this is a personal hell. They see themselves as defective beings,’ he told me. ‘This Church should be about love and justice. Now it is just worried about sex.’

Sick of seeing straight priests get away with breaking their celibacy vows, Father Mantero eventually broke his. In his parish he was ‘Don José’ or, to the young, ‘Pepe’. In gay internet chat rooms he was ‘Kyrlian’. He would travel to Madrid, visit gay bars and go to ‘hairy bear’ parties (a sub-genre of the gay scene, whose clientele consists chiefly of big paternal men with beards). There were, he insisted, hundreds, if not thousands, of gay priests in Spain. Spanish bishops declared him ‘sick’ and suffering from ‘moral disorder’. A Vatican spokesman talked of ‘a sceptic boil’.

Mantero was by no means typical of Spanish Catholics, or of their clergy. But, after meeting him, I found myself wondering why a practising gay Spanish priest, rather than, say a Pole, an Italian or an Irishman, should be the one to come out and rebel in such a public, defiant fashion. I wondered, also, why I was not surprised. Was it because I thought of Spaniards as naturally rebellious? Or because they were so often convinced they, personally, were in the right? Perhaps it was that he knew there was no need to fear social rejection? Or, simply, because other Spaniards were so rarely shocked by sex? The answer, I decided, was somewhere in a mixture of all those things.

As time goes by, the Church is losing all its battles, bar the money one, with the Spanish state. Abortion, already available practically – but not quite – on demand, is due for further liberalisation by the current Socialist government. Some British women now travel to Spain for later-term abortions that they could not legally get at home. It is a reversal of the once traditional traffic of young Spanish women travelling to London clinics. Here, again, Spaniards are deaf to the Vatican. Not even the Conservative People’s Party, during its eight years in power until 2004, dared turn the clock back.

Divorce was legalised in 1981. It was a moment of true liberation for many women, but still one that came a full six years after Franco’s death. Carmen Maura had first-hand experience of what life was like for the ‘separated’ woman under Franco. Born into a conservative family, she was educated by nuns, married at nineteen and became a full-time actress at twenty-four. She paid a huge, unfair cost for that decision. Her husband took her two children. In Franco’s Spain, having agreed to separate, she was in a no-win situation. Her own family also disowned her. Her emblematic status as Almodóvar girl and, therefore, icon of the movida is somewhat ironic. She lived little of the fervour of that exciting period in Spanish history when everything was changing at breakneck speed. ‘I was too busy trying to get my children back,’ she explained.

Franco’s death would, eventually, bring Spanish women legal equality. A new law approved in 2005 even obliges men to share domestic work and the care of children and elderly dependants. What is written in the law books, however, is still clearly not matched by what happens in most Spanish homes or, especially, workplaces. Feminism, the writer Tobias Jones said about Italy recently, passed that country by. That is not true in Spain. Spanish women have grabbed, if not militant feminism, then at least its fruits, with fervent relief. They have one big problem, however. Spanish men, as I was to discover when my children were born, have not.