SINCE Russia was awarded the 2014 Winter Olympics, it has had to deal with everything from cost overruns to the historical grievances of the Circassian diaspora and concerns over an Islamic insurgency in the north Caucasus. But an issue that the authorities did not foresee, nor seem yet to understand, now threatens to spoil its ambitions most of all.

Legislation signed by President Vladimir Putin in June outlaws “propaganda of non-traditional sexual relations” among minors. Such imprecise wording—what exactly constitutes “propaganda”?—means it could be enforced widely or not at all. So far, it has not led to a single case.

As with other recent moves, such as the ban on adoptions by Americans and the criminalisation of blasphemy, the motive seems more political than moral. A deputy from the pro-Kremlin United Russia party speaks of protecting the country against the “destruction of its fundamental cultural codes”. It is easiest to define those codes by what they are not: Western, liberal, modern. Masha Lipman of the Carnegie Moscow Centre, a think-tank, says the Kremlin has sought to “isolate and stigmatise” such people, while creating a myth of a new Russian identity from a hotchpotch of Orthodox piety, traditional values and provincial distrust of urban elites.

Gays and lesbians make easy targets. Russia is socially liberal on adultery, abortion and divorce, but attitudes to homosexuality resemble those in the West of a generation ago. Soviet-era doublethink about sex is compounded by the role of male rape in prison culture, and the stigma attached to its victims: opushenny, “made low” or debased, for life.

Yet unease and distaste, more than overt hostility, have governed public attitudes. The existence of gays and lesbians is tolerated as long as they are not seen to “contaminate” the public square, says Tanya Lokshina of Human Rights Watch, though the near-invisibility of gays and lesbians has let prejudice and misunderstanding fester. A poll by the Levada Centre found that 80% of respondents do not have a single gay acquaintance. Alexander Smirnov, who was asked to quit his job at the Moscow mayor’s office after he came out in Afisha, an arts and culture magazine, says gays are seen as “alien people”.

Now the new law adds an emotive slur to latent prejudice, by linking homosexuality and paedophilia. That resonates with a cultural idolisation of childhood purity. More than three-quarters of Russians polled say that they support the ban on gay “propaganda” to minors. In principle, the law appears to prevent any public defence of the rights of gays and lesbians—in effect, says Polina Andrianova of Coming Out, a campaign group, creating a “socially unequal” caste.

Even more worrying, she says, the law has implicitly given a “green light to aggression”. A nasty new trend is the posting of videos online showing gay men tricked into meetings where they are humiliated by vigilantes. Police treatment of gay-rights protesters has been harsh. Igor Kochetkov, another campaigner, notices “disillusionment and depression” among Russia’s gays; a poll finds that the number who experienced harassment or pressure doubled in the past year to 50%.

Russian officials still seem baffled by the idea that outsiders really care about the issue. Spurred by campaigners calling for a boycott of the Olympics, foreign governments have complained. An official of the International Olympic Committee says it is “not happy”. It tried unsuccessfully to warn the government that the new law presented a potentially “massive issue”, but its calls went unheeded.

The IOC is now waiting for a written document from a deputy prime minister, Dmitry Kozak, which should give what it calls “cast-iron assurances” that the propaganda law will not affect participants or spectators. Other Russian ministers have said repeatedly that the law will be in full force during the Olympics. A compromise for Sochi is likely—but given Mr Putin’s political priorities and society’s attitudes, the outlook for Russian gays is dark.