Oliver J Flanagan had clearly not heard of the bikini girl on the Galway beach when he made his infamous assertion in 1966 that "Sex never came to Ireland until Teilifís Eireann went on the air".

What would the Fine Gael TD have made of the students at the national seminary in Maynooth who laughed rather than fulminated when they were told the story about a priest who had noticed a young woman from his parish sprawled on a beach wearing a very brief bikini?

The priest sent the woman a note, asking her to wear a one-piece bathing suit. She returned a quick reply: "Which piece do you want me to take off?" Apocryphal? Perhaps. But the story does contains an essential element of truth which was well-articulated by Francis Hackett in January 1945. Hackett, an Irish-born literary critic in the United States, wrote an article on Ireland for The American Mercury magazine.

He was initially concerned with providing a critique of Irish neutrality and living standards, but he also focused much of his ire on the Irish denial of sex in the 1920s and 1930s, of which he had direct experience when he lived for eight years in Wicklow.

He observed: "About the problems of sex, they pretend to be doves when in fact they are ostriches.

"A Jesuit father took it upon himself to decide where, and for how long, the young were to dance. The bishops came out against late parties, mixed bathing, night rides, communism, lipstick and legs. The list of censored books previous to the war already exceeded 1,000." Hackett wove his personal experience into his assessments; he was no detached observer, but someone who had an insight into the underbelly of sexual activity and crime.

"As for the sexual morbidity, I can testify from my own observation as a juror in Wicklow, where I lived from 1929 to 1937, that de Valera closes his eyes to facts. During quarter sessions, the panel had these cases to try: a village girl accused of throwing her newborn baby out of a railway carriage; a seller of soda water charged with homosexuality on 20 counts, pleading guilty; a village elder accused of criminal assault on two children under 12, pleading guilty; a romping athletic youth, accused of raping a girl under 16, found guilty.

"In Clare, at the same time, the judge had so many sex cases, in de Valera's own stronghold, that he called it the Dirty Assize. Rape, infanticide, homosexuality, even incest, crop up." Hackett was not exaggerating; these crimes were indeed cropping up all over the country and were on the increase in the 1920s. As Hackett recognised, it was delusional to maintain that the Irish were exceptionally chaste or sexually pure, but such an insistence proved remarkably durable.

As late as 1965, the Archbishop of Dublin, John Charles McQuaid, insisted: "There is probably a saner attitude to sex in this country than almost anywhere else," words that the Ferns Report, Ryan Report and the upcoming report of sexual abuse in the Dublin diocese make a complete mockery of.

In researching the history of Irish sexuality, the historian is frequently confronted with the rhetoric of sin and "moral panic". The language associated with sex was overwhelmingly negative and judgmental. Condemnations and warnings abounded and there were deemed to be sexual traps and temptations around every corner.

In Brian Moore's novel Fergus (1971), Fr Kinneally, who taught Fergus English when he was a student, is asked by Fergus many years later if it was true that he had once cut all the corset and brassiere advertisements out of magazines on the school dentist's waiting room table. "There were young boys looking at those suggestive drawings," Fr Kinneally said. "I thought it wise. Remember, an occasion of sin is an occasion of sin, even if it is not intended to be."

The psychological effect of many years of this kind of language and instruction took its toll on some people, a notable example being the novelist Edna O'Brien, who told a journalist in 1968: "I don't think I have any pleasure in any part of my body, because my first and initial bad thoughts were blackened by the fear of sin and therefore I think of my body as a vehicle for sin, a sort of tabernacle of sin."

Her words of over 40 years ago will still resonate with a generation encouraged to equate sexual activity with sin, but as Francis Hackett recognised, there is also ample evidence that the Irish did not always obey their pious masters. Continued condemnation of sexual excess or deviance suggested there was a significant gulf between the rhetoric of Irish chastity and the reality.

There were a whole host of largely hidden Irelands that came to light during court proceedings, or as a result of private government inquiries into such issues as venereal diseases and the age of consent in the 1920s and 1930s.

With regard to many of those who emigrated in the 1950s, it was noted that much of their obedience at home had been largely superficial: in 1953, Fr Tom Fitzgerald, a native of Tipperary working as a chaplain in the east end of London, suggested that the female Irish emigrants he encountered had only been restrained at home "by outward conventions, not by faith, not by anything deep within herself".

Despite this, there was a continued articulation of the myth that "anything which tends to keep the Irish together reduces the risk of moral lapse", revealing a striking double standard; the belief that there were no such "lapses" at home in Ireland. In truth, the Irish solution was to hide and deny those who had "lapsed". And it was nearly always women who paid the price; there was an abundance of "fallen" Irish women, but no "fallen men".

By the 1960s there was a growing resentment and anger. This sense of defiance was captured in Michael Farrell's book Thy Tears Might Cease (1963), when the character Martin Reilly, having been punished and humiliated by priests about his private feelings, decides to resist them, "and think what thoughts he chose in the solitude of his own heart".

Those policing Irish personal lives in the 20th Century were not necessarily unique in their preoccupation with sexual morality. What happened in Ireland after the creation of the Free State reflected broader European and North American panic about the supposed erosion of moral standards in the aftermath of the First World War (and in Ireland's case, in the aftermath of the War of Independence and Civil War).

Irish measures against film, literature, divorce and birth control were not unusual. Nonetheless, in Ireland, it was clear that moral concerns were more prevalent in influencing prohibitions on birth control than a preoccupation with demographic patterns.

What was unique to Ireland was the reluctance to marry and the redirection of a frustrated sexuality into other areas, including residential institutions, and the recent report of the commission to inquire into child abuse has provided a corrective to the atmosphere of secrecy and shame that surrounded these experiences for so many years. The irony of all the focus on sexual morality in Ireland is that it was being conducted in a country where, in terms of official statistics, there was very little sexual activity. In 1926, 72pc of Irish men between 25 and 43 were unmarried, as were 53pc of women of that age.

These were trends that did not alter significantly until the 1950s, meaning that Ireland had the highest rates of postponed marriage and permanent celibacy of any western country that kept such records.

Clearly, the legacy of the famine, including a reluctance to subdivide land and a high premium being placed on the virtues of celibacy, had lingered.

In seeking to maintain mythical higher "moral standards" politicians continually asked for guidance from the Church.

Indeed, given what is now known about sexual abuse by clerics, it is ironic that the Church was continually being looked to for advice on legislation that was supposed to protect Irish citizens from sexual immorality. There is little doubt there were many Irish politicians during the 20th Century who saw themselves as Catholics first and legislators second, which influenced their stance on issues of sexual morality.

For much of the century, the contention that public debate on sexual morality was inappropriate stood alongside public sermonising and a preoccupation with what was seen, not what was suffered. The challenge that various authorities set themselves was to keep uncomfortable truths behind closed doors.

But towards the end of the 20th Century, as we have so painfully seen, it became more difficult and unacceptable to contain debate about sexual issues long hidden and abuses long suffered in what amounted to an overdue exposure of the myth of exceptional Irish sexual purity.